Austinkir
03-10-2009, 02:58 AM
Hi!
I am building contact page here theartslab.com/contact.php and I'm having trouble with the php code.
If I take the last lines out
else{
print "We encountered an error sending your mail, we would be eternally grateful if you were to notify webmaster@theartslab.com \n\nIf you would like to contact us, you can send an email to info@theartslab.com as well."; }
}
Then it works as intended, but with those in i get this error: "Parse error: parse error, unexpected T_ELSE in /home/content/d/r/e/drekster1/html/contact2.php on line 29"
here is the full code:
<?php
$to = $_REQUEST['Email'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "****Web contact form****";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"list"} = "Mailing List";
$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: derek@theartslab.com";
$subject2 = "Thank you for visiting TheArtsLab!";
$autoreply = "Thank you for contacting TheArtsLab! We have recieved your message, and will be contacting you shortly if nessasary. If you signed up for our newsletter you have been entered into our system.\n\n<strong>Have a good day (or night)!</strong>";
if($from == '') {print "You have not entered an email, please go back and enter a valid email. We value your privacy and will never share it with any third parties... or forth and fifth parties. Never.";}
else {
if($name == '') {print "You have not entered a name, please go back enter one... We don't mind if its not your real one.";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
print "Thank you". $Name;
}
else {
print "We encountered an error sending your mail, we would be eternally grateful if you were to notify webmaster@theartslab.com \n\nIf you would like to contact us, you can send an email to info@theartslab.com as well."; }
}
?>
and here is line 29:
else {
Thank you for any help!
Austin Kirschenmann
I am building contact page here theartslab.com/contact.php and I'm having trouble with the php code.
If I take the last lines out
else{
print "We encountered an error sending your mail, we would be eternally grateful if you were to notify webmaster@theartslab.com \n\nIf you would like to contact us, you can send an email to info@theartslab.com as well."; }
}
Then it works as intended, but with those in i get this error: "Parse error: parse error, unexpected T_ELSE in /home/content/d/r/e/drekster1/html/contact2.php on line 29"
here is the full code:
<?php
$to = $_REQUEST['Email'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "****Web contact form****";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"list"} = "Mailing List";
$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: derek@theartslab.com";
$subject2 = "Thank you for visiting TheArtsLab!";
$autoreply = "Thank you for contacting TheArtsLab! We have recieved your message, and will be contacting you shortly if nessasary. If you signed up for our newsletter you have been entered into our system.\n\n<strong>Have a good day (or night)!</strong>";
if($from == '') {print "You have not entered an email, please go back and enter a valid email. We value your privacy and will never share it with any third parties... or forth and fifth parties. Never.";}
else {
if($name == '') {print "You have not entered a name, please go back enter one... We don't mind if its not your real one.";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
print "Thank you". $Name;
}
else {
print "We encountered an error sending your mail, we would be eternally grateful if you were to notify webmaster@theartslab.com \n\nIf you would like to contact us, you can send an email to info@theartslab.com as well."; }
}
?>
and here is line 29:
else {
Thank you for any help!
Austin Kirschenmann