我在表单中添加了两个复选框,设置为在发送时邮寄到电子邮件地址。听起来不错,只是它不处理表单。在我添加复选框之前,一切都处理得很好-
这是HTML
:
<form id="form" method="post" name="validation" action="index.php" onsubmit="received()">
<fieldset>
<label for="name">Full Name:</label>
<input type="text" name="name" title="Enter your name">
<label for="attending"># Attending:</label>
<input style="margin-left:190px;" type="text" name="attending" title="Optional">
<label for="guests">Name of Guest(s): </label>
<input style="margin-left:370px;" type="text" name="guests">
<span class="fakelabel">Please Check All that Apply:</span>
<input type="checkbox" name="prenuptial" value="Yes"><span class="additions">I Will Be Attending the Prenuptial Dinner</span><br>
<input type="checkbox" name="transportation" value="Yes"><span class="additions">I Will Be Requiring Transportation To and From the Wedding</span>
<div class="submitcontainer">
<input type="submit" style="font-size:0;" name="submit" class="submitbutton" id="submit">
</fieldset>
</form>
过程(我删掉了很多,只留下新添加的区域-)
$name = strip_tags($_POST['name']);
$attending = strip_tags($_POST['attending']);
$guests = strip_tags($_POST['guests']);
$prenuptial = strip_tags($_POST['prenuptial'] == 'Yes');
$transportation = strip_tags($_POST['transportation'] == 'Yes');
$to = 'email@yahoo.com';
// Send Message
mail($email, "RE: Wedding RSVP", $intro, $headers);
mail($to, "Wedding RSVP", "Name: {$name}\n Attending: {$attending}\n Guests: {$guests}\n Prenuptial: {$prenuptial}\n Transportation: {$transportation}\n");
?>
我想知道错误是否在此处的最后一行?