Html and php form


Html and php form

我试图创建一个html和php联系人表单,但它似乎不工作。我相信这是一个简单的答案,但我想不出来。

谁能告诉我我哪里做错了?它不会重定向到mail.php页面。
        <div class="col-lg-8">
        <form action="mail.php" class="form-horizontal"  id="contactForm" name="contactForm"  method="post" >
            <div class="form-group" >

            <label for="first-name"  class="col-lg-2">First name</label>
            <div class="col-lg-10">
            <input type="text" class="form-control" id="first-name" name="first-name" placeholder="What your mam calls you ">
            </div>
    </div><!--end form group-->
    <div class="form-group">
            <label for="last-name"   class="col-lg-2">Last name</label>
            <div class="col-lg-10">
            <input type="text" class="form-control" id="last-name" name="last-name" placeholder="What your army buddies call you">
    </div>
    </div><!--end form group-->
    <div class="form-group">
            <label for="email" class="col-lg-2">Email</label>
            <div class="col-lg-10">
            <input type="text" class="form-control" id="email" name="email" placeholder="Enter your email address, we won't send you junk mail">
            </div>
    </div><!--end form group-->
    <div class="form-group">
            <label for="website" class="col-lg-2">Your current website</label>
            <div class="col-lg-10">
            <input type="text" class="form-control" id="website" name="website" placeholder="If you have one.">
    </div>
    </div><!--end form group-->
    <div class="form-group">
            <label for="message" class="col-lg-2">Any Message</label>
            <div class="col-lg-10">
            <textarea name="message" id="message" name="message" class="form-control"
            cols="20" rows="10" placeholder="Maybe tells us a bit about your business.  I'll start, mine is web development. ;)"></textarea>
            </div>
    </div><!--end form group-->
        <div class="form-group">
            <div class="col-lg-10 col-lg-offset-2">
            <button type="submit" class="btn btn-primary">Submit</button>
            </div>
        </div>
        </form>
    </div>
    </div><!--end of row-->
</section>
</div>

mail.php

    <html>
<body>
<?php 
if(isset($_POST['submit'])){
    $to = "info@wonderfulwebsites.ie"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $f_name = $_POST['first_name'];
    $s_name = $_POST['last_name'];
    $subject = "Form submission";
    $subject2 = "Copy of your form submission";
    $message = $f_name . " " . $s_name . " wrote the following:" . "'n'n" . $_POST['message'] "'n" $website = $_POST['website'];
    $message2 = "Here is a copy of your message " . $f_name . "'n'n" . $_POST['message'];
    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    echo "Mail Sent. Thank you " . $f_name . ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    // You cannot use header and echo together. It's one or the other.
    }
?>
    </body>
    </html> 

修改如下:

<button type="submit" class="btn btn-primary">Submit</button>

:

<input type="submit" class="btn btn-primary" value="Submit" />