概述
Index.php文件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312_chinese_ci" />
<title>学生信息收集系统</title>
<script language="javascript" type="text/javascript" >
function check_form(){
if(form1.tb_user.value==""){
alert("请填写学籍号!");
form1.tb_user.select();
return (false);
}
if(form1.tb_passWord.value==""){
alert("请填写密码!");
form1.tb_passWord.select();
return (false);
}
}
</script>
</head>
<body>
<center>
<h1><font color="#003333" face="Arial Black, Gadget, sans-serif">学生信息收集系统</font></h1>
<form id="form1" name="form1" method="post" action="dealwith.php">
<table align="center">
<tr>
<td>学籍号:</td>
<td><input type="text" name="tb_user"/></td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" name="tb_passWord"/></td>
</tr>
<tr align="center">
<td colspan="2" align="center"bgcolor="#FFCCFF" align="right"><input type="submit" name="subbutton" value="提交" οnclick="return check_form();"/>
<input type="reset" name="subbutton2" value="重置" /></td>
</tr>
</table>
</form>
</center>
</body>
</html>
dealwith.php文件内容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312_chinese_ci" />
<title>学生信息收集系统</title>
</head>
<?php
$host="127.0.0.1";
$userName="root";
$passWord="root";
$dbName="db_student";
$connID=mysqli_connect("$host","$userName","$passWord");
if(mysqli_select_db($connID,$dbName)){
echo "数据库选择成功";
}
else{
echo "数据选择失败";
}
if($_POST[subbutton]=="提交"){
$stuId=$_POST[tb_user];
$pasWo=$_POST[tb_passWord];
$sql=mysqli_query("select * from stuquestion where stuId ='$stuId'");
$info=mysqli_fetch_object($sql);
if($info){
if($pasWo==$info->pasWo){
echo "<script language='javascript'> alert('登陆成功!');</script>";
header('Location: answer.php');
}else{
echo "<script language='javascript'> alert('密码错误!');</script>";
header('Location: Index.php');
}
}
else{
echo "<script language='javascript'> alert('学籍号错误!');</script>";
header('Location: Index.php');
}
}
if($_POST[subbutton1]=="提交"){
$answer=$_POST[answer1];
date_default_timezone_set("PRC");
$sql1=mysqli_query("update stuquestion set queAn='$answer',timNo='date('Y-m-d H:i:s')' where stuId='$stuId'");
if($sql1){
echo "<script> alert('提交成功!');</script>";
header('Location: Index.php');
}
else{
echo "<script> alert('提交失败!');</script>";
header('Location: answer.php');
}
}
?>
<body>
</body>
</html>
最后
以上就是温柔星星为你收集整理的PHP,POST页面无法传值跳转,请大神帮助。的全部内容,希望文章能够帮你解决PHP,POST页面无法传值跳转,请大神帮助。所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复