Copy link to clipboard
Copied
I have a form on a website I am designing that I can not seem to get to work.
Here is the html part of the form:
<div id="form">
<div align="center"><img src="images/contact_form.jpg" />
</div>
<p align="center" class="style10">Fill out our form and one of our associates will contact you within 24 hours<br/>or<br/>
call<span class="style19"> 1-800-605-983</span><span class="style19">1</span> for assistance.</p>
<br/>
<form style="font-size:15px; font-family:"Times New Roman" action="form.php" method="post">
<span class="style9">First Name:</span><br/>
<input type="text" size="25" name="FirstName" /><br/><br/>
<span class="style8">Last Name:</span><br/>
<input type="text" size="25" name="LastName"/><br/><br/>
<span class="style8">Address:</span><br/>
<input type="text" size="25" name="Address" /><br/><br/>
<span class="style8">Date of Birth:</span><br/>
<input type="text" size="25" name="DateofBirth" /><br/>
<span class="style8"><br/>
Phone:</span><br/>
<input type="text" size="25" name="Phone" /><br/><br/>
<span class="style8">Alt Phone:</span><br/>
<input type="text" size="25" name="AltPhone" /><br/><br/>
<span class="style8">Best Call Time:</span><br/>
<select name="BestCallTime">
<option value="Morning">Morning</option>
<option value="Afternoon">Afternoon</option>
<option value="Evening">Evening</option>
</select>
<br/><br/>
<span class="style8">Email:</span><br/>
<input type="text" size="25" name="Email" /> <br/>
<span class="style8"><br/>
Total Debt:</span><br/>
<select name="TotalDebt">
<option value="$10,000 - $30,000">$10,000 - $30,000</option>
<option value="$30,000 - $60,000">$30,000 - $60,000</option>
<option value="$60,000 - $90,000">$60,000 - $90,000</option>
<option value="$90,000 - $120,000">$90,000 - $120,000</option>
<option value="$120,000 - $150,000">$120,000 - $150,000</option>
<option value="$150,000 - $180,000">$150,000 - $180,000</option>
<option value="$180,000 - $210,000">$180,000 - $210,000</option>
<option value="$210,000 - $240,000">$210,000 - $240,000</option>
<option value="$240,000 - $270,000">$240,000 - $270,000</option>
<option value="$270,000 - $300,000">$270,000 - $300,000</option>
<option value="$300,000 +">$300,000 +</option>
</select>
<p class="style23">(Please note there is a $10,000 minimum).</p>
<br/><br/>
<span class="style8">Comments: </span><br/>
<textarea name="Comments" cols="22" rows="7"> </textarea><br/><br/>
<input type="submit" value="Submit" />
</form>
********************************************************************************
Now here is the php document:
<?php
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Address = $_POST['Address'];
$Date_of_Birth = $_POST['DateofBirth'];
$Phone = $_POST['Phone'];
$Alt_Phone = $_POST['AltPhone'];
$Best_Call_Time = $_POST['BestCallTime'];
$Email = $_POST ['Email'];
$Total_Debt = $_POST['TotalDebt'];
$Comments = $_POST ['Comments'];
echo "Returned Information:<br><br>".$FirstName."<br>".$LastName."<br>".$Address."<br>".$Date_of_Birth."<br>".$Phone."<br>".$Alt_Phone."<br>".$Best_Call_Time."<br>".$Email."<br>".$Total_Debt."<br>".$Comments."<br>";
mail( ' cproett805@gmail.com ' , ' basic inquiry ' , $text, ' From: ' . $FirstName . ' < ' . $Email . ' >' );
header( ' Location: step3.html ' );
?>
*************************************************************************************
I have looked over many tutorials and I can not seem to find my mistake...PLEASE HELP.
Thank you.
Copy link to clipboard
Copied
How about something like this?
<?php
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Address = $_POST['Address'];
$Date_of_Birth = $_POST['DateofBirth'];
$Phone = $_POST['Phone'];
$Alt_Phone = $_POST['AltPhone'];
$Best_Call_Time = $_POST['BestCallTime'];
$Email = $_POST ['Email'];
$Total_Debt = $_POST['TotalDebt'];
$Comments = $_POST ['Comments'];
$msg = "First Name: " . $FirstName . "\n";
$msg .= "Last Name: " . $LastName . "\n";
$msg .= "Address: " . $Address . "\n";
$msg .= "Date of Birth: " . $Date_of_Birth . "\n";
$msg .= "Phone: " . $Phone . "\n";
$msg .= "Alt Phone: " . $Alt_Phone . "\n";
$msg .= "Best Call Time: " . $Best_Call_Time . "\n";
$msg .= "Email: " . $Email . "\n";
$msg .= "Total Debt: " . $Total_Debt . "\n";
$msg .= "Comments: " . $Comments . "\n";
$headers = "From: " . $Email . "\r\n" .
"Reply-To: " . $Email . "\r\n";
mail('cproett805@gmail.com', 'basic inquiry', $msg, $headers);
header('Location: step3.html ');
?>
Ken Ford
Copy link to clipboard
Copied
I tried that ken. When I click submit it redirects to step3.html like it is suppose to, but when i check my gmail account there is no email.....any ideas?
Copy link to clipboard
Copied
Here is the error log:
[16-May-2010 20:16:30] PHP Parse error: syntax error, unexpected T_STRING in /home/cbndebth/public_html/form.php on line 5
[16-May-2010 20:16:39] PHP Parse error: syntax error, unexpected T_STRING in /home/cbndebth/public_html/form.php on line 5
Copy link to clipboard
Copied
What is on line 5?
Ken Ford
Copy link to clipboard
Copied
$Date_of_Birth = $_POST['DateofBirth'];
Copy link to clipboard
Copied
could it be because the capitol letters in DateofBirth?
Copy link to clipboard
Copied
No, it normally means you forgot a semi-colon at the end of the line.
Can you post the entire code you are using?
Ken Ford
Copy link to clipboard
Copied
HTML CODE:
<div id="form">
<div align="center"><img src="images/contact_form.jpg" />
</div>
<p align="center" class="style10">Fill out our form and one of our associates will contact you within 24 hours<br/>or<br/>
call<span class="style19"> 1-800-605-983</span><span class="style19">1</span> for assistance.</p>
<br/>
<form style="font-size:15px; font-family:"Times New Roman" action="form.php" method="post">
<span class="style9">First Name:</span><br/>
<input type="text" size="25" name="FirstName" /><br/><br/>
<span class="style8">Last Name:</span><br/>
<input type="text" size="25" name="LastName"/><br/><br/>
<span class="style8">Address:</span><br/>
<input type="text" size="25" name="Address" /><br/><br/>
<span class="style8">Date of Birth:</span><br/>
<input type="text" size="25" name="DateofBirth" /><br/>
<span class="style8"><br/>
Phone:</span><br/>
<input type="text" size="25" name="Phone" /><br/><br/>
<span class="style8">Alt Phone:</span><br/>
<input type="text" size="25" name="AltPhone" /><br/><br/>
<span class="style8">Best Call Time:</span><br/>
<select name="BestCallTime">
<option value="Morning">Morning</option>
<option value="Afternoon">Afternoon</option>
<option value="Evening">Evening</option>
</select>
<br/><br/>
<span class="style8">Email:</span><br/>
<input type="text" size="25" name="Email" /> <br/>
<span class="style8"><br/>
Total Debt:</span><br/>
<select name="TotalDebt">
<option value="$10,000 - $30,000">$10,000 - $30,000</option>
<option value="$30,000 - $60,000">$30,000 - $60,000</option>
<option value="$60,000 - $90,000">$60,000 - $90,000</option>
<option value="$90,000 - $120,000">$90,000 - $120,000</option>
<option value="$120,000 - $150,000">$120,000 - $150,000</option>
<option value="$150,000 - $180,000">$150,000 - $180,000</option>
<option value="$180,000 - $210,000">$180,000 - $210,000</option>
<option value="$210,000 - $240,000">$210,000 - $240,000</option>
<option value="$240,000 - $270,000">$240,000 - $270,000</option>
<option value="$270,000 - $300,000">$270,000 - $300,000</option>
<option value="$300,000 +">$300,000 +</option>
</select>
<p class="style23">(Please note there is a $10,000 minimum).</p>
<br/><br/>
<span class="style8">Comments: </span><br/>
<textarea name="Comments" cols="22" rows="7"> </textarea><br/><br/>
<input type="submit" value="Submit" />
</form>
------------------------------------------------------------------
PHP CODE:
<?php
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Address = $_POST['Address'];
$Date_of_Birth = $_POST['DateofBirth'];
$Phone = $_POST['Phone'];
$Alt_Phone = $_POST['AltPhone'];
$Best_Call_Time = $_POST['BestCallTime'];
$Email = $_POST ['Email'];
$Total_Debt = $_POST['TotalDebt'];
$Comments = $_POST ['Comments'];
$msg = "First Name: " . $FirstName . "\n";
$msg .= "Last Name: " . $LastName . "\n";
$msg .= "Address: " . $Address . "\n";
$msg .= "Date of Birth: " . $Date_of_Birth . "\n";
$msg .= "Phone: " . $Phone . "\n";
$msg .= "Alt Phone: " . $Alt_Phone . "\n";
$msg .= "Best Call Time: " . $Best_Call_Time . "\n";
$msg .= "Email: " . $Email . "\n";
$msg .= "Total Debt: " . $Total_Debt . "\n";
$msg .= "Comments: " . $Comments . "\n";
$headers = "From: " . $Email . "\r\n" .
"Reply-To: " . $Email . "\r\n";
mail('cproett805@gmail.com', 'basic inquiry', $msg, $headers);
header('Location: confirm.html');
?>
Copy link to clipboard
Copied
Copy link to clipboard
Copied
yea i dont understand...