| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Subscribe and Support WebmasterWorld|
|Putting variables into the $body variable in mail()|
| 10:35 pm on Aug 2, 2007 (gmt 0)|
I'm working on an email form. It works until I add a variable to the $body variable contents. Can anyone see what I'm doing wrong? Here is a simplified version of what I'm doing:
$message = (isset($_POST['message'])? $_POST['message'] : '');
$email = "firstname.lastname@example.org";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From:email@example.com\r\n";
$headers .= "Reply-To:" . $email . "\r\n";
$body = "
<p>Part of the body</p>
<p>" . $message . "</p>
mail('firstname.lastname@example.org', 'This Subject', $body, $headers);
<input type='text' name='message' size='20' value='' />
<input type='submit' value='test' />
[edited by: jatar_k at 1:06 am (utc) on Aug. 3, 2007]
[edit reason] no urls thanks [/edit]
| 11:33 pm on Aug 2, 2007 (gmt 0)|
I think you may need to change <input type='submit' value='test' /> to add name="submit".
| 1:01 am on Aug 3, 2007 (gmt 0)|
Good thinking barns101, thanks. That was the problem.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2014 all rights reserved