473,408 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

PHP HTML Form mail question

Hi,

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 ?

--
Thanks,

Wayne

<?php
$to = 'w********@mydomain.com';
$subject = 'www.mydomain.com - contact';
$message = '
<html>
<head>
<title>www.mydomain.com - contact</title>
</head>
<body>
<br>
<p>Contact from www.mydomain.com</p>
<table>
<tr><td>Name</td><td>$contactname</td>
<tr><td>Email address</td><td>$contactemailaddress</td>
<tr><td>Query</td><td>$contactquery</td>
</table>
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: Webmaster <we*******@mydomain.com>' . "\r\n";
$headers .= 'From: $contactname <$contactemailaddress>' . "\r\n";
mail($to, $subject, $message, $headers);
?>
Mar 30 '06 #1
2 1130
On Thu, 30 Mar 2006 10:35:32 +0200, Wayne wrote:
Hi,

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 ?


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.

Cheers,
Andy

--
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

Mar 30 '06 #2

"Andy Jeffries" <ne**@andyjeffries.co.uk> wrote in message
news:pa****************************@andyjeffries.c o.uk...
On Thu, 30 Mar 2006 10:35:32 +0200, Wayne wrote:
Hi,

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 ?


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.


or close the quote, place the variable, continue the quote .. e.g.

$headers .= 'From: $contactname <'.$contactemailaddress.'>' . "\r\n";

Although I'm not sure what that list bit on the OP's line is trying to do.
Mar 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nancy | last post by:
Hi, Guys, I am new to Python. I am trying to following the example on http://www.modpython.org/live/current/doc-html/tut-pub.html In this example, it gives the following html code, <form...
8
by: Chris Sharman | last post by:
See the bottom of http://www.prestonbridge.pwp.blueyonder.co.uk/index2.htm (4th line of the club officers section). The mark-up's validated html 4 & css, but in ie5.0/Win2000 my surname...
4
by: ALESSANDRO Baraldi | last post by:
Good evening. Few day ago i ask about this Object. A very kindly replay of Sthepen Lebans give me the solution to use ClipBoard to synthesise the Conversion, but i've some truble. My scene: ...
2
by: akylitis | last post by:
Hello: Anyone have an opinion on the best way to formulate a dynamic HTML email? Thus far I have figured out that the only way to "build" the HTML prior to the email (I'm using System.Net.Mail)...
2
by: John | last post by:
Hello, Sorry if this is posted in the wrong area. I have an html file that has a contact form at the bottom. I didn't write the html file, but it appears that I'm missing something to...
14
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be...
2
by: lynx129 | last post by:
Hi there , I have php script that works fine under my server but I dont know how to put the html code inside my site. feedback.html <html dir="rtl"> <head> <title> ????? ??? </title>...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
3
by: anu b | last post by:
Hii I am using System.net.mail for sending email... i need to send a webpage with its html content as my email body .....for that i used mail.Isbodyhtml as true...but it is not working for me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.