在我通过单击提交按钮(显示在http://deafmagic.com/tourist-register.php上)测试表单以检查验证后,它显示了一个空白页面。我不确定我在脚本上做错了什么。需要填写文本字段旁边的红色 * 点。在我做其余的文本字段之前,我只测试了一个或两个文本字段以查看它是否有效。谢谢!
HTML(表单):
<form name="form1" method="POST" action="_sendTouristapplicant.php">
<table width="700" border="0" cellspacing="5" cellpadding="0">
<tr>
<td colspan="2" align="center"><h1 style="color:#FFFF00;">ATTENTION!!!<br />THIS REGISTRATION IS FOR <br />TOURIST APPLICANT ONLY!!!</h1><br /></td>
</tr>
<tr>
<td colspan="2"><h1>World Deaf Magicians Festival Chicago 2014</h1></td>
</tr>
<tr>
<td colspan="2"><span xml:lang="EN-US">October 26 – November 1, 2014</span>
<br /><br /><strong>Tourist Applicant ONLY</strong></td>
</tr>
<tr>
<td colspan="2" height="25"></td>
</tr>
<tr>
<td width="230" align="right" valign="top">First Name: <font style="color:red;">*</font> </td>
<td align="left" valign="top"><input name="fieldnm_1" type="text" size="33" /> </td>
</tr>
<tr>
<td align="right" valign="top">Surname (Family Name): <font style="color:red;">*</font> </td>
<td align="left" valign="top"><input name="fieldnm_2" type="text" size="33" /></td>
</tr>
<tr>
<td align="right" valign="top">Street Address: </td>
<td align="left" valign="top"><input name="fieldnm_3" type="text" size="33" /></td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top" align="center">City: <input name="fieldnm_4" type="text" size="24" /> State: <input name="fieldnm_5" type="text" size="2" /> Country: <font style="color:red;">*</font> <select id="countries" name="countries">
<option value="Zimbabwe">Zimbabwe</option>
</select></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" valign="top">Postal / Zip Code: </td>
<td align="left" valign="top"><input name="fieldnm_7" type="text" size="33" /></td>
</tr>
<tr>
<td align="right" valign="top">Email address <font style="color:red;">*</font>: </td>
<td align="left" valign="top"><input name="fieldnm_8" type="text" size="33" /></td>
</tr>
<tr>
<td valign="top" align="right">Phone Number: </td>
<td>OOVOO: <input name="oovoo" type="text" size="33" /></td>
</tr>
<tr>
<td valign="top" align="right"></td>
<td>SKYPE: <input name="skype" type="text" size="33" /></td>
</tr>
<tr>
<td align="right" valign="top">Fax: </td>
<td align="left" valign="top"><input name="fieldnm_10" type="text" size="33" /></td>
</tr>
<tr>
<td align="right" valign="top" class="txtForm">In Case of Emergency - <br />
Contact Telephone Number: </td>
<td align="left" valign="top"><input name="fieldnm_11" type="text" size="33" /></td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" align="left" valign="top">Age Group: <font style="color:red;">*</font>
<input name="fieldnm_12" type="radio" value="Junior age (7 to 17)" />Junior age (7 to 17)<input name="fieldnm_12" type="radio" value="Adult age (18 to 54)" />Adult age (18 to 54)<input name="fieldnm_12" type="radio" value="Merlin (over 55)" />Merlin (over 55)</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">Deaf, Hard of Hearing or Hearing? <br />
Deaf <input name="deafHH" type="radio" value="Deaf" /> Hard of Hearing <input name="deafHH" type="radio" value="Hard of Hearing" /></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">Hotel Room to be shared with (Magician, assistant or other person):<br />
<textarea name="fieldnm_21" cols="80" rows="5">Names:</textarea></td>
</tr>
<tr>
<td colspan="2" bgcolor="#ff0000">I agree to abide to the Contest and Festival Organizers’ Rules. I confirm that I am a Deaf Magician.<br />Yes <input name="agree" type="radio" value="Agreed" /> No <input name="agree" type="radio" value="Disagreed" /></td>
</tr>
<tr>
<td colspan="2"><br /><input type="hidden" name="submitted" value="1"> <input type="submit" name="Submit" value="Send">
<input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
PHP:
<?php ob_start();
$fromemail="Tourist Applicant"; // change here if you want
//$toemail="ff@hotmail.com"; // change here if you want
$sub="Tourist Applicant from Deaf Magic"; // change here if you want
//If form was submitted
if ($_POST['submitted']==1) {
$errormsg = ""; //Initialize errors
if ($_POST[fieldnm_1]){
$fieldnm_1 = $_POST[fieldnm_1]; //If title was entered
}
else{
$errormsg = "Please enter your first name.";
}
if ($_POST[fieldnm_2]){
$fieldnm_2 = $_POST[fieldnm_2]; //If comment was entered
}
else{
if ($errormsg){ //If there is already an error, add next error
$errormsg = "Please enter your surname.";
}
}
}
if ($title && $textentry){
//Redirect to Thank you page
header("Location: thanks.html");
}
////// do not change in following
if($_SERVER['REQUEST_METHOD']=="POST")
{
$fieldnm_1=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_1']));
$fieldnm_2=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_2']));
$fieldnm_3=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_3']));
$fieldnm_4=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_4']));
$fieldnm_5=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_5']));
$countries=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['countries']));
$fieldnm_7=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_7']));
$fieldnm_8=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_8']));
$fieldnm_9=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_9']));
$fieldnm_10=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_10']));
$fieldnm_11=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_11']));
$fieldnm_12=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_12']));
$deafHH=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['deafHH']));
$fieldnm_21=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_21']));
$agree=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['agree']));
$contentmsg=stripslashes("<br><b><font style=color:#CC3300>$sub</font></b><br>
<table width=800 border=0 cellpadding=2 cellspacing=1 bgcolor=#CCCCCC>
<tr>
<td width=600 align=right valign=top bgcolor=#FFFFFF><B>First Name:</b> </td>
<td width=200 align=left valign=top bgcolor=#FFFFFF>$fieldnm_1</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Surname:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_2</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Street Address:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_3</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>City:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_4</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>State:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_5</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Country:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$countries</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Postal / Zip Code:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_7</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Email address:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_8</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Age Group:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_12</td>
</tr>
<tr>
<td><B>Phone Number:</b></td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>OOVOO:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$oovoo</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Skype:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$skype</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Fax:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_10</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>In Case of Emergency - <br />Contact Telephone Number:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_11</td>
</tr>
<tr>
<td><B>Age Group:</b></td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Age Group:</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_12</td>
</tr>
<tr>
<td align=right valign=top bgcolor=#FFFFFF><B>Hotel Room to be shared with (Magician, assistant or other person)</b> </td>
<td align=left valign=top bgcolor=#FFFFFF>$fieldnm_21</td>
</tr>
<tr>
<td colspan=2 align=center valign=top bgcolor=#FF0000><B><font color=#ffffff>I agree to abide to the Contest and Festival Organizers’ Rules. I confirm that I am a Deaf Magician:</font></b> </td>
</tr>
<tr>
<td colspan=2 align=center valign=top bgcolor=#FFFFFF>$agree</td>
</tr>
</table>
");
////
$headers = "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";
$from=$fromemail;
$headers .= "From: ".$from."
";
@mail($toemail,$sub,$contentmsg,$headers);
}
?>