| Welcome to WebmasterWorld Guest from 188.8.131.52 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Accredited PayPal World Seller|
|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 = "email@example.com";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From:firstname.lastname@example.org\r\n";
$headers .= "Reply-To:" . $email . "\r\n";
$body = "
<p>Part of the body</p>
<p>" . $message . "</p>
mail('email@example.com', '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