Image

Imageremix_sakura wrote in Imagewebdev 😡frustrated

Listens: L'arc~en~ciel - Jiyu e no Shotai

mysterious parse errors in email form

I posted this in Imagephp yesterday, but seeing as I haven't gotten anywhere, I might as well try somewhere else.

It's just a PHP email form. I've done them several times before. I don't know why they want to spaz out on me now. Basically, the following gives me "parse error" on line line with

Email: " . $_POST['email'] . "\n\n

if I delete that line, the error is on the line above it, if I delete that one, the error keeps going up and up until I get a parse error on the line with only <?php. Which is pretty strange. The error isn't even explained, just "Parse error: parse error in /dir/dir/contact.php on line 30". I swear I've never been so frustrated with php. I've tried concatenating all the variables and functions, using <? instead of <php, rearranging things, and of course staring down the code desperately looking for a stray character, but nothing works. I know it's not great of me to ask for help with debugging, but at this point I'm feeling pretty stupid anyway.

So here is my code.

~~~~~~~~~~~~~~

<?php

ini_set ('display_errors', 1);

if (isset($_POST['submit']))
{$body = "A form has been submitted at theprmg.com\n\n

First Name: " . $_POST['firstname'] . "\n
Last Name: " . $_POST['lastname'] . "\n
Title: " . $_POST['title'] . "\n
Bsuiness: " . $_POST['business'] . "\n
Street Address: " . $_POST['streetaddr'] . "\n
City: " . $_POST['city'] . "\n
State: " . $_POST['state'] . "\n
Zip: " . $_POST['zip'] . "\n
Phone: " . $_POST['phone'] . "\n
Fax: " . $_POST['fax'] . "\n
Email: " . $_POST['email'] . "\n\n

Areas of Service:\n" .
foreach ($_POST['areas'] as $value)
{echo "$value\n";} . "\n

Information Material Request:\n" .
foreach ($_POST['materials'] as $value)
{echo "$value\n";} . "\n

Mailing List: " . $_POST['mailinglist'] . "\n\n

Comments:\n
" . $_POST['comments'];

$headers = "From: {$_POST['email']}";

mail('art@theprmg.com', 'theprmg.com Information Request Form', $body, $headers);

echo "<p>Thank you, {$_POST['firstname']}, for contacting PRMG. We will get back to you as soon as possible.</p>";}


else
{
?>

form html goes here

<?php
}
?>