我正在制作一个简单的提交表单,但似乎无法使其正常工作。
这甚至不会报告错误,这很奇怪。
已检查php.ini文件,看起来一切都正常。
HTML:
<form id="submit-form" action="receiving.php" method="POST">
<h3>Submit a Link</h3>
<fieldset>
<table>
<tr>
<td><label for="name">You</label></td>
<td><input id="name" name="name" type="text" placeholder="Your Twitter or Blog ect." /></td>
</tr>
<tr>
<td><label for="submit-links">Link(s)</label></td>
<td><input id="sumbit-links" name="submit-links" type="text" placeholder="" required="" /></td>
</tr>
<tr>
<td><input name="submit" type="submit" value="SUBMIT" /></td>
</tr>
</table>
</fieldset>
</form>
receiving.php:
<?php
error_reporting(-1);
$name = $_POST['name'];
$submit-links = $_POST['submit-links'];
if(isset($_POST['submit'])){
$from_add = "submit@webdesignrepo.com";
$to_add = "ben@webdesignrepo.com";
$subject = "Your Subject Name";
$message = "Name:$name \n Sites: $submit-links";
$headers = 'From: submit@webdesignrepo.com' . "\r\n" .
'Reply-To: ben@webdesignrepo.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion()
if(mail($to_add,$subject,$message,$headers)){
$msg = "Mail sent";
}
}
print "<p>Thanks $name</p>";
?>
非常感谢您的帮助:)
'X-Mailer: PHP/' . phpversion()
,顺便说一下,出于安全考虑,你不应该使用它,但是如果你非常想使用它,可以像这样添加:'X-Mailer: PHP/' . phpversion();
- Funk Forty Niner$msg = "Mail sent";
不会打印任何东西。你会得到一个空白屏幕。 - Funk Forty Niner