Bootstrap联系表格

时间:2014-03-12 01:47:22

标签: php forms twitter-bootstrap

**所以我正在使用这个教程http://www.html5templatesdreamweaver.com/bootstrap-form.html

我在测试表单时收到了来自我网站的电子邮件,但电子邮件中不包含表单信息。它说“询问”

这是我的

<meta charset="UTF-8">
<title>Untitled Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BOTW v.4</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
<script src="js/respond.js"></script>

这是我的表格

               <fieldset>                      <form name="enq" method="post" action="email/" onsubmit="return validation();">
                    <form role="form">
                  <div class="form-group">
                    <label for="exampleInputName1">Name</label>
                    <input type="name" class="form-control" id="exampleInputName1" placeholder="Enter name">
                  </div>
                    <form role="form">
                  <div class="form-group">
                    <label for="exampleInputEmail1">Email address</label>
                    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                  </div>
                    <form role="form">
                  <div class="form-group">
                    <label for="exampleInputMessage1">Message</label>
                    <textarea class="form-control" input type="message" rows="3" placeholder="Enter message"></textarea>
                  </div>

                    <div class="actions">
                    <input type="submit" value="Send Your Message" name="submit" id="submitButton" class="btn btn-info pull    -right" title="Click here to submit your message!" />
                    </div>  
                    </form>     
               </fieldset>           

**最后是我的Javascript

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="email/validation.js" type="text/javascript"></script>

 

任何人都知道我错过了什么?

编辑 - 和我的PHP

<?php
 if(isset($_POST['submit']))
 {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $query = $_POST['message'];
    $email_from = $name.'<'.$email.'>';

 $to="bryanontheweb@yahoo.com";
 $subject="Enquiry!";
 $headers  = 'MIME-Version: 1.0' . "\r\n";
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 $headers .= "From: ".$email_from."\r\n";
 $message="   

         Name:
         $name     
         <br>
         Email-Id:
         $email        
         <br>
         Message:
         $query        

   ";
    if(mail($to,$subject,$message,$headers))
        header("Location:../contact.php?msg=Successful Submission! Thankyou for contacting us.");
    else
        header("Location:../contact.php?msg=Error To send Email !");
        //contact:-your-email@your-domain.com
 }
?>

1 个答案:

答案 0 :(得分:0)

试试这个。 您需要为输入和textarea

添加“name”属性
<fieldset>                      <form name="enq" method="post" action="email/" onsubmit="return validation();">
                    <form role="form">
                  <div class="form-group">
                    <label for="exampleInputName1">Name</label>
                    <input type="text" name="name" class="form-control" id="exampleInputName1" placeholder="Enter name">
                  </div>
                    <form role="form">
                  <div class="form-group">
                    <label for="exampleInputEmail1">Email address</label>
                    <input type="text" name="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                  </div>
                    <form role="form">
                  <div class="form-group">
                    <label for="exampleInputMessage1">Message</label>
                    <textarea name="message" class="form-control" input rows="3" placeholder="Enter message"></textarea>
                  </div>

                    <div class="actions">
                    <input type="submit" value="Send Your Message" name="submit" id="submitButton" class="btn btn-info pull    -right" title="Click here to submit your message!" />
                    </div>  
                    </form>     
               </fieldset>