Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- PHP HTML Form mail question
March 30, 2006, 8:35 am
rate this thread
I have recently added tried to update the feedback form on my
page to be sent in HTML format.
Problem is that when its submitted, I get the mail without the
variable input, just the variable name.
I have added the text version to it and both send fine, but still only
the text version includes the variable input.
HTML code taken directly from php.net example (See my form below).
Can anyone advise how I can solve this ?
$to = 'firstname.lastname@example.org';
$subject = 'www.mydomain.com - contact';
$message = '
<title>www.mydomain.com - contact</title>
<p>Contact from www.mydomain.com</p>
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: $contactname <$contactemailaddress>' . "\r\n";
mail($to, $subject, $message, $headers);
Re: PHP HTML Form mail question
Because you've used single quotes on the line:
$message = '
If you wrap a string in single quotes variables are not substituted within
it. You need to wrap the content for $message in double quotes.
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum