一個關於註冊的php頁面
學生註冊
//######################學生註冊##########################
include "config.php";
include "header.php";?>
if ($xuehao=="" ||$name=="" || $class=="" ||$password=="" ||$password1=="" ||$telephone=="")
{
echo"請把資訊添寫完整
";
echo "";
exit;
}
$query="select * from $student_infor where no='$xuehao' and name='$name'";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
$row=mysql_fetch_array($result);
if($row==0)
{
echo"你輸入的資訊有誤,不屬於電腦學院畢業生!
";
echo "";
exit;
}
$query="select * from $student_table where xuehao='$xuehao'";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
$row=mysql_fetch_array($result);
if($row!=0)
{
echo"此學號登入,請重新填寫!
";
echo "";
exit;
}
if($password!=$password1)
{
echo"輸入的密碼不一致,請重新輸入!
";
echo "";
exit;
}
$query="insert into $student_table values('$xuehao','$name','$sex','$class','$password','$love','$telephone','$reward','')";
mysql_query("set names 'GB2312'");
$result=mysql_query($query);
if($result==true){
echo "註冊成功!
";
echo "";
exit;
}
?>
分享到:
------解決方案--------------------
register.php
extract($_POST); //加上這句
if ($xuehao==""
------解決方案--------------------