Whats wrong with my coding?
I keep getting this error:
Parse error: syntax error, unexpected $end....
PHP Code:
<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['Name'] ;
$name = $_REQUEST['Name'] ;
$address = $_REQUEST['Address'] ;
$city = $_REQUEST['City'] ;
$state = $_REQUEST['State'] ;
$zip = $_REQUEST['Zip'] ;
$phonenumber = $_REQUEST['PhoneNumber'] ;
$headers = "From: $from";
$subject = "Home Delivery Service Request";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Address"} = "Address";
$fields{"City"} = "City";
$fields{"State"} = "State";
$fields{"Zip"} = "Zip";
$fields{"PhoneNumber"} = "PhoneNumber";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: comments@cometsatx.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. We will review your request for your area and will contact you as soon as it becomes avaliable!";
if($from == '') {print "You have not entered a name, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
if($address == '') {print "You have not entered an address, please go back and try again";}
else {
if($city == '') {print "You have not entered a city, please go back and try again";}
else {
if($state == '') {print "You have not entered a state, please go back and try again";}
else {
if($zip == '') {print "You have not entered a zip code, please go back and try again";}
else {
if($phonenumber == '') {print "You have not entered a phone number, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: thankyou.htm" );}
else
{print "We encountered an error sending your mail, please notify webmaster@cometsatx.com"; }
?>
Html portion of the form code:
HTML Code:
<form method="post" action="hd.php">
<table bgcolor=#fff0c3 align=left>
<tr>
<td colspan=2><strong class="style6"><i>Request Service in Your Area:</i></strong></td></tr>
<tr><td class="style6">Department:</td><td><select name="sendto"> <option value="comments@cometsatx.com">HD Service</option></select></td></tr>
<tr><td class="style6"><font color=red>*</font> Name:</td><td><input size=25 name="Name"></td></tr>
<tr><td class="style6"><font color=red>*</font> Address:</td><td><input size=25 name="Address"></td></tr>
<tr><td class="style6"><font color=red>*</font> City:</td><td><input size=25 name="City"></td></tr>
<tr><td class="style6"><font color=red>*</font> State:</td><td><input size=1 name="State"></td></tr>
<tr><td class="style6"><font color=red>*</font> Zip:</td><td><input size=4 name="Zip"></td></tr>
<tr><td class="style6"><font color=red>*</font> Phone Number:</td><td><input size=25 name="PhoneNumber"></td></tr>
<tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr>
<tr><td colspan=2 align=center><small class="style6">A <font color=red>*</font> indicates a field is required</small></td></tr>
</table>
</form>
<br>
<p align="right"><img src="images/hdplaceholder.png" width="278" height="202"></p>
<p align="justify"> </p>
<p align="justify"> </p>
<br>
<br>
<span class="style5"><br>
</span>
<p align="justify" class="style5"><em>Any further questions can be answered by calling: (210) 332-3302 and ask our Home Delivery Service.</em></p>
<p align="justify"> </p></td>
<td background="images/index_08.png" width="7" height="46" alt=""></td>
<td background="images/index_09.png" width="242" height="46" alt="" valign="top">
Website to view form:
http://kkdigitaldesigns.com/cometcle...medelivery.htm