doudao1950 2015-06-05 06:52
浏览 46

表单值未获取

This is a contact form, when I click on submit button I am receiving the mail but form values are not fetched. I am unable to find the problem. Can someone help me?

here i include my code:

<?php
header('Content-type: application/json');
$status = array(
    'type'=>'success',
    'message'=>'Email sent!'
);

$name = @trim(stripslashes($_POST['fn'])); 
$email = @trim(stripslashes($_POST['ln'])); 
$subject = @trim(stripslashes($_POST['email'])); 
$message = @trim(stripslashes($_POST['message'])); 
$sub = 'mail from xxxx.com';
$email_from = $subject;
$email_to = 'xxxx@gmail.com';

$body = 'Name: ' . $name . "

" . 'Email: ' . $email . "

" . 'Subject: ' . $subject . "

" . 'Message: ' . $message;

$success = @mail($email_to, $sub, $body, 'From: <'.$email_from.'>');

echo json_encode($status);
die;
?>
<form id="main-contact-form" class="contact-form" name="contact-form" action="send.php" method="post"">
              <div class="row-fluid">
                <div class="span5">
                    <label>First Name</label>
                    <input type="text" name="fn" class="input-block-level" required="required" placeholder="Your First Name">
                    <label>Last Name</label>
                    <input type="text" name="ln" class="input-block-level" required="required" placeholder="Your Last Name">
                    <label>Email Address</label>
                    <input type="text" name="email" class="input-block-level" required="required" placeholder="Your email address">
                </div>
                <div class="span7">
                    <label>Message</label>
                    <textarea name="message" id="message" required="required" class="input-block-level" rows="8"></textarea>
                </div>

            </div>
            <input type="submit" >
            <p> </p>

        </form>
  • 写回答

1条回答 默认 最新

  • dongyuandou2521 2015-06-08 07:13
    关注

    I can solve this problem with silly mistake....

    <form id="main-contact-form" class="contact-form" name="contact-form" action="send.php" method="post"">
    

    in this line i can give so changes is

    <form id="main-contact-form" class="contact-form" name="contact-form" action="send.php" method="post">
    
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数