我已经用php写了一个注册页面,一切正常,值被保存在数据库中,但它在值保存到数据库后不会打开下一页这里是我的代码。请检查可能是什么问题。
<?php
if (isset($_POST['button']))
{
$st_name=$_POST['st_name'];
$f_name=$_POST['f_name'];
$email=$_POST['email'];
$re_email=$_POST['re_email'];
$pass=$_POST['pass'];
$re_pass=$_POST['re_pass'];
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
$skype=$_POST['skype'];
$quali=$_POST['quali'];
$country=$_POST['country'];
$city=$_POST['city'];
$date=$_POST['date'];
$g=$_POST['g'];
$image="back.jpg";
if($email!=$re_email){
echo "<script>window.open('sign_up.php?error=email_error','_self')</script>";
}
else if($pass!=$re_pass){
echo "<script>window.open('sign_up.php?error=pass_error','_self')</script>";
}
else{
$que="insert into sign_up(st_name,f_name,email,re_email,pass,re_pass,phone,mobile,skype,quali,country,city,date,gender,image)
values ('$st_name','$f_name','$email','$re_email','$pass','$re_pass','$phone','$mobile','$skype','$quali','$country','$city','$date','$g','$image')";
if(mysql_query($que))
{
$_SESSION['email']=$email;
$_SESSION['pass']=$pass;
header("location: index.php");
}
else{
mysql_error();
}
}
}
?>
发布于 2015-10-16 00:35:59
问题是您在调用header()
函数之前输出了一些内容。在调用该函数之前,您需要确保HTML输出中没有任何内容(甚至没有空格)。
发布于 2015-10-16 00:18:09
简单的打字错误
变化
header("location: index.php");
至
header("Location: index.php");
发布于 2015-10-16 00:21:00
不确定这是否有区别,但header("location: index.php");
需要在位置header("Location: index.php");
上将L大写
https://stackoverflow.com/questions/33153527
复制相似问题