Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Mail() problem
July 8, 2008, 7:50 pm
rate this thread
I can't get the following code snippet to stop throwing errors except to
modify it exactly as shown here by adding the single quote to the end of
the first line and commenting out all but the first line:
<?php <========= This is line 108 mentioned in the error msg
$header="Return-Path: ".$mailuser." \r\n";
$header .="From: Bad Link<".$mailuser.">\r\n";
$header .="Content-Type: text/html;";
$mail_body = '
<br>User: ' . $email .' submitted a form re: BAD LINK '<===this line
//<br>Zip: ' . $_POST['zipcode2'] . '<br>
//<br>City: '. $_POST['city'] . '<br>
//<br>Link: '. $_POST['page'] . '<br>
//<br/>Link Wording: ' . $_POST['wording'] . '<br/>
//<br/>Details: ' $_POST[;details'] ' . <br/>
//<br/>Response? ' $_POST['respond'] . '<br/> '
//mail($mailuser, 'Form Sent', $header, $mail_body );
Parse error: syntax error, unexpected T_VARIABLE in
C:\xampp\htdocs\ContactUs\badLinkCheck.php on line 108
By inserting/deleting blank lines, I've determined the error is in the
'$mail_body =' section, not the $headers area. But that's as close as I
can get it. I thought the $_POST was wrong, but it's identical to the
format used in another, fully functional form. In fact, the first 3
lines of the mail body are identical to the working form. Not that that
proves the other form is "right"!<G>
Moving the single quote indicated above to the second line, say, and
uncommenting the second line, in addition to the first line (or
without), throws an error. As it does with any of the $_POST lines.
But darned if I can see anything wrong with it. I'ver read/reread the
manual & a few other articles til I'm blue in the face without success.
The $_POST names are all available; just before the mail() section
because I echo them all to the screen to be certain they existed and
they display as expected.
Any comments or advice?
Resolved Re: Mail() problem
Thanks Jerry, that was the push I needed. Knowing there wasn't anything
obviously wrong about the snip I posted helped an awful lot.
For any newbies reading, yes, I know there is also a "." missing before
the variable in each of the two last lines, just in case anyone noticed;
that wasn't the issue.