PDA

View Full Version : sendresults.php issue


euge1089
07-18-2012, 06:55 PM
Hello Everyone,
I am new to the this website, but to begin, I have started creating websites a few months ago and have never had a problem with forms until now. The issue is that the form just doesn't send to my email, i have tried troubleshooting and couldn't figure anything out. The sendresults.php still redirects me to my next page but thats about it, it just doesn't email me the form results. Please help!
Thanks,
Eugene

Form Code:
<form id="PurchaseForm" name="PurchaseForm" action="sendresults.php" method="post">
<table width="750" border="1" align="center">
<tr>
<td width="243" class="tablecolor">Full Name</td>
<td width="491"><span id="sprytextfield1">
<input name="text1" type="text" id="text1" size="50" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="tablecolor">Desired Date of Birth</td>
<td><span id="spryselect1">
<label for="DOB"></label>
<select name="DOB" id="DOB">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span><span id="spryselect2">
<label for="DOB2"></label>
<select name="DOB2" id="DOB2">
<option value="Jan">Jan</option>
<option value="Feb">Feb</option>
<option value="Mar">Mar</option>
<option value="Apr">Apr</option>
<option value="May">May</option>
<option value="Jun">Jun</option>
<option value="Jul">Jul</option>
<option value="Aug">Aug</option>
<option value="Sep">Sep</option>
<option value="Oct">Oct</option>
<option value="Nov">Nov</option>
<option value="Dec">Dec</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span><span id="spryselect3">
<label for="DOB3"></label>
<select name="DOB3" id="DOB3">
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
</tr>
<tr>
<td class="tablecolor">ID Choice</td>
<td><span id="spryselect4">
<label for="ID Selection"></label>
<select name="ID Selection" id="ID Selection">
<option value="Boston College">Boston College</option>
<option value="Boston University">Boston University</option>
<option value="Quincy College">Quincy College</option>
<option value="Quinipaic University">Quinipaic University</option>
<option value="Umass Amherst">Umass Amherst</option>
<option value="Fairfield University">Fairfield University</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
</tr>
<tr>
<td class="tablecolor">Shipping Name</td>
<td><span id="sprytextfield2">
<label for="Shipping Name"></label>
<input name="Shipping Name" type="text" id="Shipping Name" size="50" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="tablecolor">Delivery Address</td>
<td><span id="sprytextfield3">
<label for="Delivery Address"></label>
<input name="Delivery Address" type="text" id="Delivery Address" size="50" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="tablecolor">City</td>
<td><span id="sprytextfield4">
<label for="City"></label>
<input name="City" type="text" id="City" size="50" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="tablecolor">State</td>
<td><span id="sprytextfield5">
<label for="State"></label>
<input name="State" type="text" id="State" size="50" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="tablecolor">ZIP</td>
<td><span id="sprytextfield6">
<label for="ZIP"></label>
<input name="ZIP" type="text" id="ZIP" size="50" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="tablecolor">Additional Info</td>
<td><span id="sprytextarea1">
<label for="Add Info"></label>
<textarea name="Add Info" id="Add Info" cols="50" rows="5"></textarea>
</span></td>
</tr>
<tr>
<td class="tablecolor"><input name="Submit" type="submit" class="tablecolor" id="Submit" value="Submit" /></td>

</tr>
</table>
<p>&nbsp;</p>
</form>

sendresults.php:

<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Purchase Form';

// Your email address. This is where the form information will be sent.
$emailadd = 'dmattie97@yahoo.com';

// Where to redirect after form is processed.
$url = 'http://www.funidcards.com/upload.php';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

edbr
07-19-2012, 02:17 AM
save this as a php page ie mailtest.php, go to it on your server and check if you get sent an email (every time its refreshed)

euge1089
07-19-2012, 05:44 PM
Thank You so much!

edbr
07-20-2012, 01:58 AM
its just a test to see if the mail() function is working