想知道是否有人可以帮助我发现我的表单设置中的缺陷?电子邮件正在通过,但没有消息发送者输入的信息:
电子邮件正文:
名称:
电子邮件:
现有客户:
组织类型:
消息:
这是HTML:
<form action="email.php" method="POST" name="contact" enctype="text/plain">
<label for="name">Name: </label><input type="text" name="name" id="name">
<label for="email">Email: </label><input type="text" name="email" id="email"><br><br>
<label for="existing">Have you written before?</label>
<input type="radio" name="existing" value="Yes" id="existingyes">Yes
<input type="radio" name="existing" value="No" id="existingno">No<br><br>
<label for="orgtype">How do you classify yourself? </label><select id="orgtype">
<option>Charity</option>
<option>Business</option>
<option>Individual</option>
<option>Meat Popcicle</option>
<option>Other</option>
</select><br><br>
<label for="essay">Thoughts? Questions? Comments</label><br>
<textarea name="essay" rows="3" cols="70" id="essay">...</textarea><br><br>
<input type="submit" value="Yell At Us!"><br>
这是PHP:
<?php
$name = stripslashes($_POST['name']);
$email = stripslashes($_POST['email']);
$existing = stripslashes($_POST['existing']);
$orgtype = stripslashes($_POST['orgtype']);
$essay = stripslashes($_POST['essay']);
$form_message = "Name: $name \nEmail: $email \nExisting Customer: $existing \nOrg Type: $orgtype \nMessage: $essay";
$success = mail("myemail@email.com", "Online Form Submission", $form_message, "From: $email" );
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">";
} else {
echo "Sorry error please try again...";
}
?>
非常感谢任何帮助!
答案 0 :(得分:0)
从enctype="text/plain"
代码中移除form
。
<form action="email.php" method="POST" name="contact">
你可以在这里阅读 method="post" enctype="text/plain" are not compatible?