Page 1 of 1

Help with php Mail Form Function mail()

Posted: Thu Dec 23, 2004 10:12 am
by blasterstudios
I am a php noob designing my first complex contact form. I'm using the form found here:
http://www.christian-web-masters.com/ar ... orm-2.html

I'm trying to mix this with a multi-line message. here is my code:

Code: Select all

<?php
	@extract($_POST);
	$Name = stripslashes($FirstName) & " " & stripslashes($LastName);
	$Address1 = stripslashes($Address);
	$Address2 = stripslashes($City) & ", " & stripslashes($State) & " " & stripslashes($Zip);
	$Phone = stripslashes($Phone);
	$BestTime = stripslashes($BestTime);
	$Email = stripslashes($Email);
	$Subject = "Contact Form Information";
	$Comments = stripslashes($Comments);
	$Message = '
	<html>
	<head>
	 <title>Online Contact Form</title>
	</head>
	<body>
	<p>This e-mail was generated by the online contact form on LA Weight Loss contact page.</p>
	<br>
	<p>Name: <?php $Name ?><br>
	<p>Address: <?php $Address1 ?><br>
	<p>&nbsp;&nbsp; <?php $Address2 ?><br>
	<p>Phone: <?php $Phone ?><br>
	<p>Best Time to Contact: <?php $BestTime ?><br>
	<p>E-mail Address: <?php $Email ?><br>
	<p>Comments: <?php $Comments ?><br>
	</body>
	</html>
	';
	mail('bdichiar@al.com',$Subject,$Message,"From: $Name <$Email>");
?>
But all I get in my e-mail is the HTML Characters and no dynamic content. How do I get this to work?

Posted: Thu Dec 23, 2004 10:15 am
by Hibba
You need to have something in the header to say that it is html content.
$header = "Content-type: text/html\r\n";