I'm really new at this and I'm tearing my hair out trying to understand what i've done wrong here. I keep getting these parse errors and although I seemed to fix some of them, now I keep getting this one...
Parse error: syntax error, unexpected $end in /home/stinkyp1/public_html/contact.php on line 32
...and I just can't figure it out. I've read the other threads with similar problems and tried the solutions suggested but now I think i might be making it worse.
All I want to do is have a form on my site that emails me the info from the field boxes and thanks them for submitting it.
Here is the code I've used for the form:
<form method="post" action="/contact.php">
<table bgcolor=#ffffcc border=8 align=center>
<tr><td colspan=2 align=center><strong>Book your collection using this form:</strong></td></tr>
<tr><td>Area:</td><td><select name="sendto">
<option value="info@stinkypoos.com">Gold Coast</option>
<option value="info@stinkypoos.com">Brisbane</option>
<option value="info@stinkypoos.com">Other</option>
</select></td></tr>
<tr><td>Name:</td><td><input size=45 name="Name"></td></tr>
<tr><td>Email:</td><td><input size=45 name="Email"></td></tr>
<tr><td>Phone:</td><td><input size=45 name="Phone"></td></tr>
<tr><td>Address:</td><td><input size=45 name="Address"></td></tr>
<tr><td colspan=2>Message (optional):</td></tr>
<tr><td colspan=2 align=center><textarea name="Message" rows=5 cols=52></textarea></td></tr>
<tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr>
<tr><td colspan=2 align=center>Stinky Poos will contact you shortly</small></td></tr>
</table>
</form>
and here is the code I've used for the contact file:
<?php
$to = "info@stinkypoos.com" ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $name <$from>";
$subject = "Web Contact Data";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Email"} = "Email";
$fields{"Message"} = "Message";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: You <noreply@stinkypoos.com>";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usually within 48 hours.";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
if($phone == '') {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)
{print "Thank you for contacting us."; }
else
{print "We encountered an error sending your mail, please notify [email]webmaster@stinkypoos.com[/email]"; }
}
}
Can someone please help me?