JAVA日报

php(ex02a.php)

<?php

if(isset($_POST['name'])&&isset($_POST['sex'])){
$ID = $_POST['name'];
$sex = $_POST['sex'];
$conn2=mysqli_connect("localhost","root","123","text3") or die("数据库连接失败");
mysqli_query($conn2,'set names utf8');
$sql3="select * from student where id='$ID' and sex='$sex'";
$result=mysqli_query($conn2,$sql3)or die("数据查询失败");
if($result -> num_rows==0){
echo "<script>alert('没有找到您的信息!') ;"."window.location.href='ex02b.php?name=".$ID."&sex=".$sex."'"."</script>";
}
else{
echo "<script>"."window.location.href='ex02c.php?name=".$ID."&sex=".$sex."'"."</script>";
}
$conn2->close();
}
?>
<div style="position: absolute;height: 60%; 70%;left: 20%;top: 15%">
<form action="ex02a.php" method="post">
<table border="1" style="height: 100%; 100%">
<tr>
<td style="text-align: center" colspan="3">
用户登录
</td>

</tr>
<tr>
<td>真实姓名:</td>
<td colspan="2"><input name="name" type="text"></td>
</tr>
<tr>
<td>性别:</td>
<td><input type="radio" name="sex" value="男">男<input type="radio" name="sex" value="女">女</td>
</tr>
<tr>
<td colspan="3" style="text-align: center">
<input type="submit" value="提交" >
<input type="reset" value="重置">
</td>
</tr>
</table>
</form>
</div>
<script>

</script>
原文地址:https://www.cnblogs.com/mumulailai/p/14912402.html