Here is the html for my form:
<form name="gsginfo" method="post" action="contact.php">
<h3>Would you like more information?</h3>
<p> Name:
<input name="name" type="text" id="name" size="40" maxlength="40">
<span class="style3">*</span></p>
<p>Address:
<input name="address" type="text" id="address" size="60" maxlength="60">
</p>
<p>City:
<input name="city" type="text" id="city" size="25" maxlength="25">
</p>
<p>State:
<input name="state" type="text" id="state" size="2" maxlength="2">
</p>
<p>Zip:
<input name="zip" type="text" id="zip" size="10" maxlength="10">
</p>
<p>Phone:
<input name="phone" type="text" id="phone" size="15" maxlength="15">
<span class="style3">*<span class="style2">In case we have problems with your email.</span></span></p>
<p>Email:
<input name="email" type="text" id="email" size="30" maxlength="30">
<span class="style3">*</span></p>
<p>Questions/Comments:
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</p>
<p> </p>
<p>
<input name="submit" type="submit" id="submit">
</p>
</form>
and here is my php:
<?php
$to = "tadams@forestry.state.sc.us";
$from = $_REQUEST['email'] ;
$name = $_REQUEST['name'] ;
$header = "From: $from";
$subject = "Grow Some Green" ;
$fields = array();
$fields{"name"} = "Name";
$fields{"address"} = "Address";
$fields{"city"} = "City";
$fields{"state"} = "State";
$fields{"zip"} = "Zip";
$fields{"phone"} = "Phone";
$fields{"email"} = "Email";
$fields{"comments"} = "Comments-Questions";
$body = "We have received the following information:"; foreach($fields as $a => $b){
$body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$autoreply = "Thank you for your interest in Grow Some Green. Someone will contact you
shortly. If you have any more questions, please consult our website at
www.growsomegreen.com";
if($email == '') {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 to get in touch with you in
case we have problems replying to your email, please go back and try again";}
else {
$send = mail($to, $subject, $body, $header);
if($send)
{header( "Location: http://www.state.sc.us/forest/thankyou.htm" );}
else
{print "We encountered an error sending your mail, please notify
webmaster@YourCompany.com"; }
?>
What did I do wrong?
Any help or suggestions wold be welcomed. I don't know php.