View Full Version : Parse Error ??

01-10-2006, 11:13 PM
I am new to this forum and i just need help with this error msg that appears after I click the submit button for filling out a form and sending it to an e-mail. Please help me. Here is the PHP file:


$to = "webmaster@intermountaincoach.com"
$subject = "Results from your Request Info form"
$headers = "From: Form Mailer"
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "contact.php"

## set up the time ##

$date = date ("l, F jS, Y");
$time = date ("h:i A");

## mail the message ##

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";


This is the message that I get when I send a test form:
Parse error: parse error, unexpected T_VARIABLE in /home/intermou/public_html/mailer.php on line 12

And here is the form itself:

<form action="mailer.php" method="post">
<table width="100%">
<tr><td>Name:</td><td><input type="text" name="name" /></td></tr>
<tr><td>E-Mail:</td><td><input type="text" name="email" /></td></tr>
<tr><td>Phone:</td><td><input type="text" name="phone" /></td></tr>
<tr><td colspan="2">Comments:</td></tr>
<td><input type="checkbox" name="reserve" value="yes" />
<td><input type="checkbox" name="inquire" value="yes" />
<td valign="top">Vehicle Type: </td>
<select name="vehicle" multiple="multiple">
<option value="van">Van</option>
<option value="bus">Bus</option>
<option value="car">Car</option>
<option value="suv">SUV</option>
<tr><td colspan="2" align="center"><input type="submit" /></td></tr>

Thanks in advance to those who can help!!!

01-10-2006, 11:43 PM
Hey guys nevermind! I got it going!!! :thumbsup: