| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Gold Sponsor 2015! |
|Putting variables into the $body variable in mail()|
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]
I think you may need to change <input type='submit' value='test' /> to add name="submit".
Good thinking barns101, thanks. That was the problem.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved