当我提交formet时,显示ablank contact.php页面没有结果,也没有发送邮件。
这是contact.php:
<?php
if (isset($_POST["submit"])) {
$fname = $_POST['first'];
$lname = $_POST['last'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = ' Info Bank contact ';
$to = 'infobankml@gmail.com';
$subject = 'contact form ';
$body = "From: " .$fname . "\n". $lname . "E-Mail: ". $email."\n". " Message:" ."\n". $message;
if (mail ($to, $subject, $body, $from)){
header('location : success.html');
}
else
{
header('location : fail.html');
}
}
?>
这是html表格:
<form action="contact.php" method="post" name="form">
<h4>Contact us today, and get reply with in 24 hours!</h4>
<fieldset>
<input placeholder="Your first name" type="text" name="first" required>
</fieldset>
<fieldset>
<input placeholder="Your last name" type="text" name="last" required>
</fieldset>
<fieldset>
<input placeholder="Your Email Address" type="email" name="email" required>
</fieldset>
<fieldset>
<textarea placeholder="Type your Message Here...." name="message" required></textarea>
</fieldset>
<fieldset>
<button name="submit" type="submit" name="submit" data-submit="...Sending">Submit</button>
</fieldset>
</form>