If you want to do a simpler system, you can always use the idea I suggested originally.
All you need is the original form and a form processing page with mail function.
The mail function will contain all the variables captured from the form.
1stly, there will be no changes to the orginal layout of the form, as these will be picked up in page 2.
Page 2 will capture all the form fields and put them into variables as follows.
<?php
$formfield1=$_POST['formfield1'];
$formfield2=$_POST['formfield2'];
$formfield3=$_POST['formfield3'];
?>
You can assign as many post variables as you want.
Further down the page, you can format your mail headers and mail script, which, in its most basic form is as follows:
<?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= 'From: you(you@whatever.com)' . "\r\n";
$headers .= 'Reply-To:
you@whatever.com' . "\r\n";
$headers .= 'Return-Path:'.$contactemail. "\r\n";
$headers .= 'X-Sender: '.$contactemail. "\r\n";
$headers .= 'X-Mailers: PHP /'.phpversion() . "\r\n";
$subject = "Subject - Something";
$message = '
<html>
<body>
Some Content
</body>
</html>
';
ini_set(sendmail_from,$contactemail);
if (@mail(''.$firstname.' '.$lastname.'<'.$contactemail.'>',stripslashes($su bject),stripslashes($message),stripslashes($header s)))
{
echo ('
<p>e-mail successfully sent to '. $contactemail . '</p>
');
}
else
{
echo ('
<p>Error! The e-mail has failed to send to ' . $contactemail . '. Please try again.</p>
');
}
ini_restore( sendmail_from );
?>
Then you just have the message to resolve.
Just copy the entire html and put it in where I have put
Some content.
Finally, we just have to insert the posted variables into the html in the message.
To do this, you need to make a break in the code by inserting:
'.(the php variable).'
As an example, you could have an html table:
<table>
<tr>
<td>Result from first form field</td>
<td>'.$formfield1.'</td>
</tr>
<tr>
<td>Result from 2nd form field</td>
<td>'.$formfield2.'</td>
</tr>
<tr>
<td>Result from 3rd form field</td>
<td>'.$formfield3.'</td>
</tr>
</table>
The whole script for the 2nd page would therefore be:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form processing script</title>
<?php
$contactemail=$_POST['formfieldemail'];
$formfield1=$_POST['formfield1'];
$formfield2=$_POST['formfield2'];
$formfield3=$_POST['formfield3'];
?>
</head>
<body>
<?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= 'From: you(you@whatever.com)' . "\r\n";
$headers .= 'Reply-To: you@whatever.com' . "\r\n";
$headers .= 'Return-Path:'.$contactemail. "\r\n";
$headers .= 'X-Sender: '.$contactemail. "\r\n";
$headers .= 'X-Mailers: PHP /'.phpversion() . "\r\n";
$subject = "Subject - Something";
$message = '
<html>
<body>
<table>
<tr>
<td>Result from first form field</td>
<td>'.$formfield1.'</td>
</tr>
<tr>
<td>Result from 2nd form field</td>
<td>'.$formfield2.'</td>
</tr>
<tr>
<td>Result from 3rd form field</td>
<td>'.$formfield3.'</td>
</tr>
</table>
</body>
</html>
';
ini_set(sendmail_from,$contactemail);
if (@mail('<'.$contactemail.'>',stripslashes($subject),stripslashes($message),stripslashes($headers)))
{
echo ('
<p>e-mail successfully sent to '. $contactemail . '</p>
');
}
else
{
echo ('
<p>Error! The e-mail has failed to send to ' . $contactemail . '. Please try again.</p>
');
}
ini_restore( sendmail_from );
?>
</body>
</html>
If you desperately want to cling to the complex pre-made script you are trying to adapt - good luck!