我创建了这个联系表单,它在 Firefox 和 chrome 中完美运行,但在 Internet Explorer 中,它不允许您输入文本(单击表单字段没有任何作用)提交按钮有效但只发送空白消息,因为无法输入文本。此外,当您按下提交时,它会尝试在 Firefox 页面中打开 mail.php,我只是在我的电脑上进行本地测试,这可能是问题吗?
PHP是这样的:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$formcontent="This message has been generated from the Contact page \n Name: $name \n Phone: $phone \n Email: $email \n Message: $message";
$recipient = "myemail@myemail.co.uk";
$subject = "Enquiry From contact page";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
header('Location: ../contact2.html');
?>
HTML是:
<form id="form1" action="PHP/mail.php" method="post">
<label>Name <span class="small">Add your name</span></label>
<input type="text" name="name"><br>
<label>Email <span class="small">Enter a Valid Email</span></label>
<input type="text" name="email"><br>
<label>Phone <span class="small">Add a Phone Number</span></label>
<input type="text" name="phone"><br>
<br>
<br>
<label>Message <span class="small">Type Your Message</span></label>
<textarea name="message" rows="6" cols="25">
</textarea><br>
<button type="submit" value="Send" style="margin-top:15px;">Submit</button>
<div class="spacer"></div>
</form>