PDA

View Full Version : PHP form parse error



aewgliriel
September 14th, 2008, 10:53 PM
Hi, guys, I'm hoping someone can help me. I read the tutorial on the php form, and i carefully followed the directions, but apparently i did something wrong, because when I went to test it, I got this error:

Parse error: parse error, unexpected T_ELSE in /home/content/a/s/t/astorcreations/html/testsite/mailer.php on line 15

The PHP code I'm using looks like this:



<?php
if(isset($_POST['submit'])) {
$to = "info@a-stor-creations.com";
$subject = "Contact From A Stor Creations Website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$comments = $_POST['comments'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";

$body = "From: $name_field\n E-Mail: $email_field\n Inquiry: $check_msg\n Message:\n $comments";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);

} else {
echo "blarg!";
}
?>

and my form itself is here: http://www.a-stor-creations.com/testsite/contact.html

I don't work with PHP much, though I'm in web design for my job. I have no idea where to begin to fix this, but any help or insight you guys could give me would be greatly appreciated.

Templarian
September 14th, 2008, 11:26 PM
Your missing a } for your foreach(){}

aewgliriel
September 14th, 2008, 11:47 PM
Your missing a } for your foreach(){}

. . . *facepalm*:doh: Now I feel like an idiot. Thanks!