Hello,
I’m using the following php to write form info to a mysql database and then email an email address with this information. At the end of the form I’d like the user to be redirected to a new page (e.g., a thanks for submitting page).
Right now the database writing and emailing parts work fine.
I’ve tried using a hidden redirect field on the form html and using the header location php function but both didn’t work.
Any help is always greatly appreciated.
Thanks
[code]<?php
$con = mysql_connect(“localhost”,“dbname”,“password”);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}mysql_select_db(“dbname”, $con);$sql="INSERT INTO table
(
id,
name,
phone,
email,
fax
)
VALUES
(
‘’,
‘$_POST[name]’,
‘$_POST[phone]’,
‘$_POST[email]’,
‘$_POST[fax]’
)
";if (!mysql_query($sql,$con))
{
die('Error: ’ . mysql_error());
}
echo "Your info has been recorded. ";mysql_close($con)
?>
<?php // Contact subject $subject ="New info Received"; // Details $message=" Name: $_POST[name] Phone: $_POST[phone] Email: $_POST[email] Fax: $_POST[fax] Status: $_POST[status] Post Date: $_POST[postdate] "; $mail_from="[email protected]"; $header="from: EMAIL "; $to ='[email protected]'; $send_contact=mail($to,$subject,$message,$header); if($send_contact){ echo ""; } else { echo "ERROR"; } ?>[/code]