PHP 中的 HTML 联系我们 表格



我已经尝试在PHP中与我们联系表单,现在当它提交并且未在表单中填写的用户数据时,应该将用户重新引用以再次填写。 所以我目前拥有的代码是:

<?php
$all = 'All fields are required, please fill <a href="">the form</a> again.'
$action=$_REQUEST['action'];
if ($action=="")    /* display the contact form */
{
?>
<form  action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="submit">
Your name:<br>
<input name="name" type="text" value="" size="30"/><br>
Your email:<br>
<input name="email" type="text" value="" size="30"/><br>
Your message:<br>
<textarea name="message" rows="7" cols="30"></textarea><br>
<input type="submit" value="Send email"/>
</form>
<?php
} 
else                /* send the submitted data */
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$message=$_REQUEST['message'];
if (($name=="")||($email=="")||($message==""))
{
echo $all;
}
else{       
$from="From: $name<$email>rnReturn-path: $email";
$subject="Message sent using your contact form";
// mail("email@email.com", $subject, $message, $from);
echo "Email sent!";
}
}  
?>

现在由于某种原因,我正在使用 All fields are required, please fill <a href="">the form</a> again.它不会隐藏自己的 它出现了我觉得很奇怪的?

这是进一步解释的实时链接

我假设你在代码中有错误, 第二个字符串应使用 ";">

最新更新