我有一个脚本可以将输入表单的电子邮件提交到数据库,我想知道在提交邮件后是否有重定向PHP脚本的方法?在脚本运行后重定向PHP
我的脚本 -
<?php
$con = mysql_connect("localhost","User","Pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("emails", $con);
$sql="INSERT INTO mlist (email)
VALUES
('$_POST[email]'')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con)
?>
请能有人给明确的指示,因为我学习PHP仍。
如果不产生任何输出; `header(“Location:http://www.example.com/redirect/to/otherpage_or_samepage.php?with = different_variables“);`但要小心,如果你输出一些东西然后发送一个不同的头文件,你会得到一个错误... – acm 2011-01-07 10:19:12