...

View Full Version : PHP mail form stops at blank



sackstein
03-17-2009, 04:47 PM
Hello,

I have been trying to create a fairly simple form which emails the contents. The problem I have encountered is that if the user leaves one input box blank the form stops there and it does not email anything after that box.

Here is the code for the html page:

<!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>

<title>
Registration
</title>

<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- CSS -->
<link rel="stylesheet" href="css/structure.css" type="text/css" />
<link rel="stylesheet" href="css/form.css" type="text/css" />

</head>

<body id="public">


<div id="container">


<form id="form1" name="form1" class="wufoo " autocomplete="on"
enctype="multipart/form-data" method="post" action="mail.php">

<div class="info">
<h2>Pre School Registration Application</h2>
<div>Register now while there is still room!</div>
</div>

<ul>


<li id="foli0" class=" ">
<label class="desc" id="title0" for="Field0">
Name
<span id="req_0" class="req">*</span>
</label>
<span>
<input id="Field0" name="Field0" type="text" class="field text" value="" size="2" tabindex="1" />
<label for="Field0">Title</label>
</span>
<span>
<input id="Field1" name="Field1" type="text" class="field text" value="" size="8" tabindex="2" />
<label for="Field1">First</label>
</span>
<span>
<input id="Field2" name="Field2" type="text" class="field text" value="" size="12" tabindex="3" />
<label for="Field2">Last</label>
</span>
<span>
<input id="Field3" name="Field3" type="text" class="field text" value="" size="3" tabindex="4" />
<label for="Field3">Suffix</label>
</span>
</li>


<li id="foli16" class=" ">
<label class="desc" id="title16" for="Field16">
Child's Name
<span id="req_16" class="req">*</span>
</label>
<span>
<input id="Field16" name="Field16" type="text" class="field text" value="" size="2" tabindex="5" />
<label for="Field16">Title</label>
</span>
<span>
<input id="Field17" name="Field17" type="text" class="field text" value="" size="8" tabindex="6" />
<label for="Field17">First</label>
</span>
<span>
<input id="Field18" name="Field18" type="text" class="field text" value="" size="12" tabindex="7" />
<label for="Field18">Last</label>
</span>
<span>
<input id="Field19" name="Field19" type="text" class="field text" value="" size="3" tabindex="8" />
<label for="Field19">Suffix</label>
</span>
</li>


<li id="foli21" class=" ">
<label class="desc" id="title21" for="Field21">
Child's Age
<span id="req_21" class="req">*</span>
</label>
<div>
<input id="Field21" name="Field21" type="text" class="field text medium" value="" maxlength="255" tabindex="9" />
</div>
</li>


<li id="foli5" class=" ">
<label class="desc" id="title5" for="Field5">
Address
<span id="req_5" class="req">*</span>
</label>
<div class="column">
<span class="full">
<input id="Field5" name="Field5" type="text" class="field text addr" value="" tabindex="10" />
<label for="Field5">Street Address</label>
</span>
<span class="full">
<input id="Field6" name="Field6" type="text" class="field text addr" value="" tabindex="11" />
<label for="Field6">Address Line 2</label>
</span>
<span class="left">
<input id="Field7" name="Field7" type="text" class="field text addr" value="" tabindex="12" />
<label for="Field7">City</label>
</span>
<span class="right">
<input id="Field8" name="Field8" type="text" class="field text addr" value="" tabindex="13" />
<label for="Field8">State / Province / Region</label>
</span>
<span class="left">
<input id="Field9" name="Field9" type="text" class="field text addr" value="" maxlength="15" tabindex="14" />
<label for="Field9">Postal / Zip Code</label>
</span>
<span class="right">
<select id="Field10" name="Field10" class="field select addr" tabindex="15" >
<option value="" selected="selected"></option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</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="Brazil">Brazil</option>
<option value="Brunei">Brunei</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="Central African Republic">Central African Republic</option>
<option value="Chad">Chad</option>
<option value="Chile">Chile</option>
<option value="China">China</option>
<option value="Colombia">Colombia</option>
<option value="Comoros">Comoros</option>
<option value="Congo">Congo</option>
<option value="Costa Rica">Costa Rica</option>
<option value="C&ocirc;te d'Ivoire">C&ocirc;te 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="East Timor">East Timor</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="Fiji">Fiji</option>
<option value="Finland">Finland</option>
<option value="France">France</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="Greece">Greece</option>
<option value="Grenada">Grenada</option>
<option value="Guatemala">Guatemala</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="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">Iran</option>
<option value="Iraq">Iraq</option>
<option value="Ireland">Ireland</option>
<option value="Israel">Israel</option>
<option value="Italy">Italy</option>
<option value="Jamaica">Jamaica</option>
<option value="Japan">Japan</option>
<option value="Jordan">Jordan</option>
<option value="Kazakhstan">Kazakhstan</option>
<option value="Kenya">Kenya</option>
<option value="Kiribati">Kiribati</option>
<option value="North Korea">North Korea</option>
<option value="South Korea">South Korea</option>
<option value="Kuwait">Kuwait</option>
<option value="Kyrgyzstan">Kyrgyzstan</option>
<option value="Laos">Laos</option>
<option value="Latvia">Latvia</option>
<option value="Lebanon">Lebanon</option>
<option value="Lesotho">Lesotho</option>
<option value="Liberia">Liberia</option>
<option value="Libya">Libya</option>
<option value="Liechtenstein">Liechtenstein</option>
<option value="Lithuania">Lithuania</option>
<option value="Luxembourg">Luxembourg</option>
<option value="Macedonia">Macedonia</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="Mauritania">Mauritania</option>
<option value="Mauritius">Mauritius</option>
<option value="Mexico">Mexico</option>
<option value="Micronesia">Micronesia</option>
<option value="Moldova">Moldova</option>
<option value="Monaco">Monaco</option>
<option value="Mongolia">Mongolia</option>
<option value="Montenegro">Montenegro</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="New Zealand">New Zealand</option>
<option value="Nicaragua">Nicaragua</option>
<option value="Niger">Niger</option>
<option value="Nigeria">Nigeria</option>
<option value="Norway">Norway</option>
<option value="Oman">Oman</option>
<option value="Pakistan">Pakistan</option>
<option value="Palau">Palau</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="Poland">Poland</option>
<option value="Portugal">Portugal</option>
<option value="Puerto Rico">Puerto Rico</option>
<option value="Qatar">Qatar</option>
<option value="Romania">Romania</option>
<option value="Russia">Russia</option>
<option value="Rwanda">Rwanda</option>
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<option value="Saint Lucia">Saint Lucia</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 and Montenegro">Serbia and Montenegro</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="Spain">Spain</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Sudan">Sudan</option>
<option value="Suriname">Suriname</option>
<option value="Swaziland">Swaziland</option>
<option value="Sweden">Sweden</option>
<option value="Switzerland">Switzerland</option>
<option value="Syria">Syria</option>
<option value="Taiwan">Taiwan</option>
<option value="Tajikistan">Tajikistan</option>
<option value="Tanzania">Tanzania</option>
<option value="Thailand">Thailand</option>
<option value="Togo">Togo</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="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="Uruguay">Uruguay</option>
<option value="Uzbekistan">Uzbekistan</option>
<option value="Vanuatu">Vanuatu</option>
<option value="Vatican City">Vatican City</option>
<option value="Venezuela">Venezuela</option>
<option value="Vietnam">Vietnam</option>
<option value="Yemen">Yemen</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select>
<label for="Field10">Country</label>
</span>
</div>
</li>


<li id="foli11" class=" ">
<label class="desc" id="title11" for="Field11">
Email
<span id="req_11" class="req">*</span>
</label>
<div>
<input id="Field11" name="Field11" type="text" class="field text medium" value="" maxlength="255" tabindex="16" />
</div>
</li>


<li id="foli12" class=" ">
<label class="desc" id="title12" for="Field12">
Phone Number
<span id="req_12" class="req">*</span>
</label>
<span>
<input id="Field12" name="Field12" type="text" class="field text" value="" size="3" maxlength="3" tabindex="17" /> -
<label for="Field12">(###)</label>
</span>
<span>
<input id="Field12-1" name="Field12-1" type="text" class="field text" value="" size="3" maxlength="3" tabindex="18" /> -
<label for="Field12-1">###</label>
</span>
<span>
<input id="Field12-2" name="Field12-2" type="text" class="field text" value="" size="4" maxlength="4" tabindex="19" />
<label for="Field12-2">####</label>
</span>
</li>



<li class="buttons">
<input id="saveForm" class="btTxt" type="submit" value="send" />
</li>

<li style="display:none">
<label for="comment">Do Not Fill This Out</label>
<textarea name="comment" id="comment" rows="1" cols="1"></textarea>
</li>
</ul>
</form>

</div><!--container-->
<img id="bottom" src="images/bottom.png" alt="" />

</body>
</html>

and here is the code for the php:


Thank You we have received your request and will get back to you shortly. <a href="../index.html">Return Home
</a>
<?php
$ToEmail = 'mymmail@gmail.com';
$EmailSubject = 'Registration';
$mailheader = "From: ".$_POST["Field11"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["Field11"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY .= "Name: ".$_POST["Field0"]." ";
$MESSAGE_BODY .= " ".$_POST["Field1"]." ";
$MESSAGE_BODY .= " ".$_POST["Field2"]." ";
$MESSAGE_BODY .= " ".$_POST["Field3"]."<br><br>";
$MESSAGE_BODY .= "Child's Name: ".$_POST["Field16"]." ";
$MESSAGE_BODY .= " ".$_POST["Field17"]." ";
$MESSAGE_BODY .= " ".$_POST["Field18"]." ";
$MESSAGE_BODY .= " ".$_POST["Field19"]."<br><br>";
$MESSAGE_BODY .= "Child's Age: ".$_POST["Field21"]."<br><br>";
$MESSAGE_BODY .= "Address: ".$_POST["Field5"]."<br>";
$MESSAGE_BODY .= " ".$_POST["Field6"]."<br>";
$MESSAGE_BODY .= " ".$_POST["Field7"]." ";
$MESSAGE_BODY .= ",".$_POST["Field8"]."<br>";
$MESSAGE_BODY .= " ".$_POST["Field9"]."<br>";
$MESSAGE_BODY .= " ".$_POST["Field10"]."<br><br>";
$MESSAGE_BODY .= "Email: ".$_POST["Field11"]."<br><br>";
$MESSAGE_BODY .= "Tel: ".$_POST["Field12"]." ";
$MESSAGE_BODY .= " ".$_POST["Field12-1"]." ";
$MESSAGE_BODY .= " ".$_POST["Field12-2"]."<br><br>";
$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
?>

Fumigator
03-17-2009, 06:41 PM
Do you have error reporting turned on? Maybe something's happening but you're not seeing the error? Also what do you see when you echo $MESSAGE_BODY? Is it also cut off?

sackstein
03-17-2009, 07:42 PM
I do not have error reporting turned off.

If all the form is filled I get the email with all the info. If it is not all filled I get the email with all the info up until the point where the user left the box blank.

there is no error returned it seems as if it should work.

Im not sure what you mean by echo $MESSAGE_BODY

I am pretty none informed in terms of php.

Tynan
03-18-2009, 06:31 PM
I'm a basic coder myself, I'm not being funny but this is fairly fundamental stuff with a billion examples online

why not just copy an example and then build the form up as necessary?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum