我在网上找到了一个内置HTML联系表单的模板。我一直在尝试添加一个有效的PHP脚本来使其工作。这是HTML表单
<div class="span_of_2">
<div class="span_1_of_2">
<div class="contact-form">
<form method="action" action="contact-post.php">
<div>
<span><label>name</label></span>
<span><input name="userName" type="text" class="textbox"></span>
<div class="clear"></div>
</div>
<div>
<span><label>e-mail</label></span>
<span><input name="userEmail" type="text" class="textbox"></span>
<div class="clear"></div>
</div>
<div>
<span><label>Message</label></span>
<span><textarea name="userMsg"> </textarea></span>
<div class="clear"></div>
</div>
<div>
<span><input type="submit" class="" value="Send"></span>
</div>
</form>
</div>
</div>
这是我的contact-post.php
{
$name=$_REQUEST['userName'];
$email=$_REQUEST['userEmail'];
$message=$_REQUEST['userMsg'];
if (($name=="")||($email=="")||($message==""))
{
echo "All fields are required, please fill <a href=\"\">the form</a> again.";
}
else{
$from="From: $name<$email>\r\nReturn-path: $email";
$subject="Message sent using your contact form";
mail("youremail@yoursite.com", $subject, $message, $from);
echo "Email sent!";
}
}
&GT;
而不是PHP文档执行它的操作它只需要我/ctact-post.php只是带有代码行的文档。谁能协助我纠正我的代码?我非常感激。