我目前有以下工作正常的电子邮件/数据库脚本,但重定向似乎不起作用。而不是重定向到 url 它只是显示空白 php 页面。我怎样才能解决这个问题?
<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("register", $con);
$sql="INSERT INTO register_interest (Name, Email, Message, Website)
VALUES ('$_POST[Name]', '$_POST[Email]', '$_POST[Message]', '$_POST[Website]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
$to = "email";
$subject = "Interest";
$email = $_POST['Email'] ;
$message = $_POST['Message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if ($sent) {
header("Location: http://www.url.co.uk");
exit();
} else {
print "We encountered an error sending your email";
}
?>