I am having issues with my page. I am trying to send a email to a different address based on the entry that my user submits.
Here is my form on my test page.
[code]
Test |
here is the php code for my formdata page
[php]<?php
$con = mysql_connect(“localhost”,“test”,“test”);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}
mysql_select_db(“test”, $con);
$sql=“INSERT INTO formdata (test)
VALUES (’$_POST[test]’)”;
if (!mysql_query($sql,$con))
{
die('Error: ’ . mysql_error());
}
echo “Your Information Was Successfully Posted”;
mysql_close($con);
if ($_POST[‘test’] ==“A”){
$to = "[email protected]";
$subject = “Custom Form”;
$message = $_POST[‘test’] ;
$headers = “From: [email protected]”;
$sent = mail($to, $subject, $message, $headers) ;
} else if ($_POST[‘test’] ==“B”){
$to = "[email protected]";
$subject = “Custom Form”;
$message = $_POST[‘test’] ;
$headers = “From: [email protected]”;
$sent = mail($to, $subject, $message, $headers) ;
}
if($sent)
{print “
Your mail was sent successfully”; }
else
{print “
We encountered an error sending your mail”; }
?>[/php]