Hi there
Im new to the forum (and to php), and was hoping someone could point me in the right direction.
Im trying to embed a php variable into a html output email.
So far I have created the html form, and a sample php function for sending the email (shown below). In the php processing script I can retrieve the form values and assigned them to a variable but I'm having problems using these variables in the email html output.
Here's my code:
<?php
// recipient
$to = 'jamez100@------------';
$subject = 'WebForm';
//form values, txtbox,txtbox,textarea
$name_textbox = $_POST['txtName'];
$textbox_Email = $_POST['txtcontactemail'];
$textarea_Message = $_POST['txtmessage'];
// this is the email html output
$message = '
<html>
<head>
</head>
<body>
<h1>Page Title</h1>
<p>Name: <?=$name_textboxo?> 'Here I would like to add the form textbox value
</p>
<p>Email : <?=$textbox_Email?> </P
<p>etc</p>
</html>
';
//SMTP server name
ini_set("SMTP","localhost");
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: jamez100@---------------' . "\r\n";
$headers .= 'From: jamez100@--------------' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
Any help would be greatly appreciated.
Regards, James



Reply With Quote

Bookmarks