Hello:
I have a basic contact form with three items to fill in: name, email, and message.
After the form is submitted, I was successful in writing a script which presents a confirmation page to the user.
I also need this script to send an email. I tried a number of different things and with everything I tried I came up with a different result. One time I received no email. Another version printed the information from the form twice on the confirmation page. Plus, the left navigation bar was wider than it should be. My final attempt, gave me an email which showed all the info appearing twice, a confirmation page with all the info appearing twice, and a left nav bar wider than it should be.
Help! Can someone point me in the right direction on how to modify my script so I can send an email and keep my confirmation page as is? I would like the email to have the information formatted as in the confirmation page.
There was one option I didn't try, yet, and I'm not sure if it would even work. Rather than placing all functions in the one script, do you think if I create a seperate PHP script that just handles the email part and then include it into my main script?
Here's the URL for the contact form so you can see what the confirmation page should look like: http://www.metalroofingtools.com/contact-us.htm.
Also, here is my script which is currently running correctly but does not send an email.
<?php
include ('header.php');
?>
<?php
$name=$POST['name'];
$email=$POST['email'];
$message=$_POST['message'];
?>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber8">
<tr>
<td width="4%"> </td>
<td width="62%"> </td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%"><b><font face="Verdana" size="4" color="#800000">
CONFIRMATION</font></b></td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%"> </td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%">
<p align="left"><font face="Verdana" size="2">Thank you for
contacting MetalRoofingTools.com. Your request for information
was submitted.</font></p>
<p align="left"><font face="Verdana" size="2">A representative will
contact you to discuss your needs. A confirmation email was
sent to you.</font></p>
<p>
<?php
echo "<table border='0' width='60%'>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "Contact Name:</font></b></td>";
echo "<td width='60%'>";
echo $name;
echo "</td></tr>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "Email Address:</font></b></td>";
echo "<td width='60%'>";
echo $email;
echo "</td></tr>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "Message:</font></b></td>";
echo "<td width='60%'>";
echo $message;
echo "</td></tr>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "</td>";
echo "<td width='60%'>";
echo "</td></tr>";
echo "</table>";
?>
</p>
<p align="left"> </td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%"> </td>
</tr>
</table>
<p align="left">
</td>
<td width="3%" height="294"> </td>
</tr>
</table>
</td>
</tr>
<?php
include ('footer.php');
?>
Any help would be greatly appreciated? I've looked at so many different methods of coding email and I feel like I'm chasing my tail. No pun intended.
🙂
Thank you in advance.