0

在我通过单击提交按钮(显示在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);
}               
?>
4

4 回答 4

0

这是“tourist-register.php”整个页面:

请将此上传到您的网站,并告诉我所有表单值是否都符合您的要求。如果是这样,我将为您编写处理器。可以肯定的是..您想要此表格做的只是向您发送电子邮件并向客户显示感谢页面?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to Deaf Magic!</title>
<style type="text/css">
/* copy */
.copy { font-size:14px; color:#FFFFFF; padding-top:250px; font-family:Verdana, Arial, Helvetica, sans-serif; line-height:20px;}
.copy h1 {font-size:18px; font-family:Georgia, "Times New Roman", Times, serif;}

/* Front large images */
img.front-image { display: block; margin-left: auto; margin-right: auto; }
/* Container */
.container { margin-left:510px; background-image:url(images/internal_topbg.jpg); background-repeat:no-repeat; width:900px; height:auto;}
/* navigational buttons */
.button_wrapper {width:900px; margin-left:510px; margin-top:550px;}
.buttons { display: inline; }
.button-image { padding-left: 10px;}
.yellow-buttons { width:600px; margin-left:680px; margin-top:20px; }
/* footer image */
.footer-bg {margin-left:510px; margin-top:50px; background-image:url(images/internal_bottombg.jpg); background-repeat:no-repeat; width:900px; height:284px; }
div.divider{ width:720px;background-color:#222;font-family:sans-serif; font-weight:bold;border-radius:10px;
padding:4px 10px;margin-top:10px;}
div.agree{ width:720px;background-color:#FF0000;font-family:sans-serif; font-weight:bold;border-radius:10px;
padding:4px 10px;margin-top:10px;}
div.form{ width:720px;}
div.form label{display:inline-block;  width:250px;font-family:sans-serif; font-weight:bold; font-size:16px;}
div.form input, textarea, select {display:inline-block;margin-left:20px; }
</style>
</head>

<body bgcolor="#000000" link="#1690e9" alink="#1690e9" vlink="#1690e9">
<div class="container">
<div class="copy">

<div align="center">
<h1 style="color:#FFFF00;">ATTENTION!!!<br />
THIS REGISTRATION IS FOR <br />
TOURIST APPLICANT ONLY!!!</h1><br />
<h1>World Deaf Magicians Festival Chicago 2014</h1>
<span xml:lang="EN-US">October 26 – November 1, 2014</span><br /><br />
<strong>Tourist Applicant ONLY</strong>
</div><br><br>

<div class="form" >

<form name="form1" method="POST" action="tourist_email.php">

<label><font style="color:red;">*</font>Firstname:</label><input name="first_name" type="text" size="45" autofocus /><br>

<label><font style="color:red;">*</font>Surname(Family Name):</label><input name="last_name" type="text" size="45" /><br>

<label>Street Address:</label><input name="street" type="text" size="45" /><br>

<label>City:</label><input name="city" type="text" size="45" /><br>

<label>State:</label><input name="state" type="text" size="2" />

Zip Code:<input name="zip" type="text" size="10" /><br>

<label><font style="color:red;">*</font>Country:</label><select name="countries">
<option value="Afghanistan">Afghanistan</option>
<option value="Åland Islands">Åland Islands</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antarctica">Antarctica</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</option>
<option value="Aruba">Aruba</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
<option value="Azerbaijan">Azerbaijan</option>
<option value="Bahamas">Bahamas</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Barbados">Barbados</option>
<option value="Belarus">Belarus</option>
<option value="Belgium">Belgium</option>
<option value="Belize">Belize</option>
<option value="Benin">Benin</option>
<option value="Bermuda">Bermuda</option>
<option value="Bhutan">Bhutan</option>
<option value="Bolivia">Bolivia</option>
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
<option value="Botswana">Botswana</option>
<option value="Bouvet Island">Bouvet Island</option>
<option value="Brazil">Brazil</option>
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<option value="Brunei Darussalam">Brunei Darussalam</option>
<option value="Bulgaria">Bulgaria</option>
<option value="Burkina Faso">Burkina Faso</option>
<option value="Burundi">Burundi</option>
<option value="Cambodia">Cambodia</option>
<option value="Cameroon">Cameroon</option>
<option value="Canada">Canada</option>
<option value="Cape Verde">Cape Verde</option>
<option value="Cayman Islands">Cayman Islands</option>
<option value="Central African Republic">Central African Republic</option>
<option value="Chad">Chad</option>
<option value="Chile">Chile</option>
<option value="China">China</option>
<option value="Christmas Island">Christmas Island</option>
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<option value="Colombia">Colombia</option>
<option value="Comoros">Comoros</option>
<option value="Congo">Congo</option>
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
<option value="Cook Islands">Cook Islands</option>
<option value="Costa Rica">Costa Rica</option>
<option value="Cote D'ivoire">Cote D'ivoire</option>
<option value="Croatia">Croatia</option>
<option value="Cuba">Cuba</option>
<option value="Cyprus">Cyprus</option>
<option value="Czech Republic">Czech Republic</option>
<option value="Denmark">Denmark</option>
<option value="Djibouti">Djibouti</option>
<option value="Dominica">Dominica</option>
<option value="Dominican Republic">Dominican Republic</option>
<option value="Ecuador">Ecuador</option>
<option value="Egypt">Egypt</option>
<option value="El Salvador">El Salvador</option>
<option value="Equatorial Guinea">Equatorial Guinea</option>
<option value="Eritrea">Eritrea</option>
<option value="Estonia">Estonia</option>
<option value="Ethiopia">Ethiopia</option>
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
<option value="Faroe Islands">Faroe Islands</option>
<option value="Fiji">Fiji</option>
<option value="Finland">Finland</option>
<option value="France">France</option>
<option value="French Guiana">French Guiana</option>
<option value="French Polynesia">French Polynesia</option>
<option value="French Southern Territories">French Southern Territories</option>
<option value="Gabon">Gabon</option>
<option value="Gambia">Gambia</option>
<option value="Georgia">Georgia</option>
<option value="Germany">Germany</option>
<option value="Ghana">Ghana</option>
<option value="Gibraltar">Gibraltar</option>
<option value="Greece">Greece</option>
<option value="Greenland">Greenland</option>
<option value="Grenada">Grenada</option>
<option value="Guadeloupe">Guadeloupe</option>
<option value="Guam">Guam</option>
<option value="Guatemala">Guatemala</option>
<option value="Guernsey">Guernsey</option>
<option value="Guinea">Guinea</option>
<option value="Guinea-bissau">Guinea-bissau</option>
<option value="Guyana">Guyana</option>
<option value="Haiti">Haiti</option>
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
<option value="Honduras">Honduras</option>
<option value="Hong Kong">Hong Kong</option>
<option value="Hungary">Hungary</option>
<option value="Iceland">Iceland</option>
<option value="India">India</option>
<option value="Indonesia">Indonesia</option>
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
<option value="Iraq">Iraq</option>
<option value="Ireland">Ireland</option>
<option value="Isle of Man">Isle of Man</option>
<option value="Israel">Israel</option>
<option value="Italy">Italy</option>
<option value="Jamaica">Jamaica</option>
<option value="Japan">Japan</option>
<option value="Jersey">Jersey</option>
<option value="Jordan">Jordan</option>
<option value="Kazakhstan">Kazakhstan</option>
<option value="Kenya">Kenya</option>
<option value="Kiribati">Kiribati</option>
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
<option value="Korea, Republic of">Korea, Republic of</option>
<option value="Kuwait">Kuwait</option>
<option value="Kyrgyzstan">Kyrgyzstan</option>
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
<option value="Latvia">Latvia</option>
<option value="Lebanon">Lebanon</option>
<option value="Lesotho">Lesotho</option>
<option value="Liberia">Liberia</option>
<option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<option value="Liechtenstein">Liechtenstein</option>
<option value="Lithuania">Lithuania</option>
<option value="Luxembourg">Luxembourg</option>
<option value="Macao">Macao</option>
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
<option value="Madagascar">Madagascar</option>
<option value="Malawi">Malawi</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mali">Mali</option>
<option value="Malta">Malta</option>
<option value="Marshall Islands">Marshall Islands</option>
<option value="Martinique">Martinique</option>
<option value="Mauritania">Mauritania</option>
<option value="Mauritius">Mauritius</option>
<option value="Mayotte">Mayotte</option>
<option value="Mexico">Mexico</option>
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
<option value="Moldova, Republic of">Moldova, Republic of</option>
<option value="Monaco">Monaco</option>
<option value="Mongolia">Mongolia</option>
<option value="Montenegro">Montenegro</option>
<option value="Montserrat">Montserrat</option>
<option value="Morocco">Morocco</option>
<option value="Mozambique">Mozambique</option>
<option value="Myanmar">Myanmar</option>
<option value="Namibia">Namibia</option>
<option value="Nauru">Nauru</option>
<option value="Nepal">Nepal</option>
<option value="Netherlands">Netherlands</option>
<option value="Netherlands Antilles">Netherlands Antilles</option>
<option value="New Caledonia">New Caledonia</option>
<option value="New Zealand">New Zealand</option>
<option value="Nicaragua">Nicaragua</option>
<option value="Niger">Niger</option>
<option value="Nigeria">Nigeria</option>
<option value="Niue">Niue</option>
<option value="Norfolk Island">Norfolk Island</option>
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
<option value="Norway">Norway</option>
<option value="Oman">Oman</option>
<option value="Pakistan">Pakistan</option>
<option value="Palau">Palau</option>
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
<option value="Panama">Panama</option>
<option value="Papua New Guinea">Papua New Guinea</option>
<option value="Paraguay">Paraguay</option>
<option value="Peru">Peru</option>
<option value="Philippines">Philippines</option>
<option value="Pitcairn">Pitcairn</option>
<option value="Poland">Poland</option>
<option value="Portugal">Portugal</option>
<option value="Puerto Rico">Puerto Rico</option>
<option value="Qatar">Qatar</option>
<option value="Reunion">Reunion</option>
<option value="Romania">Romania</option>
<option value="Russian Federation">Russian Federation</option>
<option value="Rwanda">Rwanda</option>
<option value="Saint Helena">Saint Helena</option>
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<option value="Saint Lucia">Saint Lucia</option>
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
<option value="Samoa">Samoa</option>
<option value="San Marino">San Marino</option>
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Senegal">Senegal</option>
<option value="Serbia">Serbia</option>
<option value="Seychelles">Seychelles</option>
<option value="Sierra Leone">Sierra Leone</option>
<option value="Singapore">Singapore</option>
<option value="Slovakia">Slovakia</option>
<option value="Slovenia">Slovenia</option>
<option value="Solomon Islands">Solomon Islands</option>
<option value="Somalia">Somalia</option>
<option value="South Africa">South Africa</option>
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
<option value="Spain">Spain</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Sudan">Sudan</option>
<option value="Suriname">Suriname</option>
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
<option value="Swaziland">Swaziland</option>
<option value="Sweden">Sweden</option>
<option value="Switzerland">Switzerland</option>
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
<option value="Tajikistan">Tajikistan</option>
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
<option value="Thailand">Thailand</option>
<option value="Timor-leste">Timor-leste</option>
<option value="Togo">Togo</option>
<option value="Tokelau">Tokelau</option>
<option value="Tonga">Tonga</option>
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
<option value="Tunisia">Tunisia</option>
<option value="Turkey">Turkey</option>
<option value="Turkmenistan">Turkmenistan</option>
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<option value="Tuvalu">Tuvalu</option>
<option value="Uganda">Uganda</option>
<option value="Ukraine">Ukraine</option>
<option value="United Arab Emirates">United Arab Emirates</option>
<option value="United Kingdom">United Kingdom</option>
<option value="United States">United States</option>
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
<option value="Uruguay">Uruguay</option>
<option value="Uzbekistan">Uzbekistan</option>
<option value="Vanuatu">Vanuatu</option>
<option value="Venezuela">Venezuela</option>
<option value="Viet Nam">Viet Nam</option>
<option value="Virgin Islands, British">Virgin Islands, British</option>
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
<option value="Wallis and Futuna">Wallis and Futuna</option>
<option value="Western Sahara">Western Sahara</option>
<option value="Yemen">Yemen</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select>
<br>


<label>Email address</label><input name="email" type="email" size="45" /><br>

<label>Phone Number:</label><input name="phone" type="text" size="45" /><br>

<label>OOVOO:</label><input name="oovoo" type="text" size="45" /><br>

<label>SKYPE:</label><input name="skype" type="text" size="45" /><br>

<label>Fax:</label><input name="fax" type="text" size="45" /><br>

<label>Emergency Contact Number:</label><input name="emer_contact" type="text" size="45" /><br>

<div align="left" class="divider"><label><font style="color:red;">*</font>Age Group:</label><br> </div>
<input name="age_group" type="radio" value="Junior age (7 to 17)" /><label>Junior age (7 to 17)</label><br>
<input name="age_group" type="radio" value="Adult age (18 to 54)" /><label>Adult age (18 to 54)</label><br>
<input name="age_group" type="radio" value="Merlin (over 55)" /><label>Merlin (over 55)</label><br><br>


<div align="left" class="divider"><label>Deaf, Hard of Hearing? </label><br /></div>
<input name="deafHH" type="radio" value="Deaf" /><label>Deaf </label><br>
<input name="deafHH" type="radio" value="Hard of Hearing" /><label>Hard of Hearing</label><br><br>

<div align="left" class="divider">Hotel Room to be shared with (Magician, assistant or other person):</div><br />
<textarea name="room_contents" cols="85" rows="5">Names:</textarea><br><br>

<div align="center" class="agree">
I agree to abide to the Contest and Festival Organizers’ Rules. I confirm that I am a Deaf Magician.<br />
<input name="agree" type="radio" value="Agreed" />Yes<input name="agree" type="radio" value="Disagreed" />No<br><br>
</div>


<div align="center">
<br><br>
<input type="submit" name="submit_tourist" value="Send">
<input type="reset" name="Submit2" value="Reset">
</div>



</div>







</div>
</div>
<div class="button_wrapper" align="center">
    <div class="buttons"><a href="index.html"><img class="button-image" src="images/button.home.png" border="0" /></a></div>
    <div class="buttons"><a href="world_wdmf_2014.html"><img class="button-image" src="images/button.wdmf2014.png" border="0" /></a></div>
    <div class="buttons"><a href="history.html"><img class="button-image" src="images/button.history.png" border="0" /></a></div>
    <div class="buttons"><a href="donations.html"><img class="button-image" src="images/button.donations.png" border="0" /></a></div>
    <div class="buttons"><a href="contact.php"><img class="button-image" src="images/button.contact.png" border="0" /></a></div>
</div>
<div class="yellow-buttons">
<a href="magicians-applicant.php"><img class="button-image" src="images/button.applicants2.png" border="0" /></a>
<a href="#"><img class="button-image" src="images/button.deardeafhh2.png" border="0" /></a>
</div>
<div class="footer-bg"></div>
</body>
</html>
于 2012-12-25T23:51:47.627 回答
0

先全部改 $fieldnm_1 = $_POST[fieldnm_1];

至:

$fieldnm_1 = $_POST['fieldnm_1'];

含义...您需要在$_POST[''];

于 2012-12-25T17:18:01.520 回答
0

您开始输出缓冲

ob_start();

但是我看不到您最终将收集到的数据输出到哪里。如果你不这样做 - 这解释了空白页。

这个

str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_1']))

可以替换为

nl2br($_REQUEST['fieldnm_1']);

我建议将错误从字符串更改为数组。

重定向条件最好改为

if (count($errormsg) == 0){ 
//Redirect to Thank you page 
   header("Location: thanks.html");   
}  


//If form was submitted  
if ($_POST['submitted']==1) {  
    $errormsg = array(); //Initialize errors  
    if (strlen(trim($_POST['fieldnm_1']))){  
        $title = $_POST['fieldnm_1']; //If title was entered  
    }  
    else{  
        $errormsg[] = "Please enter your first name.";  
    }  
    if (strlen(trim($_POST['fieldnm_2']))){  
        $textentry = $_POST['fieldnm_2']; //If comment was entered  
    }  
    else{  
        $errormsg[] = "Please enter your surname.";  
    }  
}   

如果你想在页面上输出错误 - 使用implode("<br>", $errors)而不是 $errors

于 2012-12-25T17:24:02.160 回答
0

您还想检查是否完全提交了 $_POST。最好用 isset 检查变量。此外,您需要在 POST 中使用单引号。像这样:

if (isset($_POST['submitted'])) {  
$errormsg = ""; //Initialize errors  
if (isset($_POST['fieldnm_1'])){  
    $fieldnm_1 = $_POST['fieldnm_1']; //If title was entered  
}  

if (isset($title) && isset($textentry)){ 
//Redirect to Thank you page 
   header("Location: thanks.html");   
}  

http://php.net/manual/en/function.isset.php

于 2012-12-25T17:30:16.770 回答