添加用户
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../js/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>后台登录</title>
<link href="../css/login.css" type="text/css" rel="stylesheet">
<script type="text/javascript">
$(document).ready(function(){
$("#name").focus();
$("#name").blur(function(){
var name=$("#name").val();
if (name) {
$.post("../conn/one.php",{'name':name},function(data){
alert(data);
});}else{
alert("gaisgujhubunengweikoong");
}
});
$("#but").click(function(){
var name=$("#name").val();
var password=$("#password").val();
var sex=$("#sex").val();
var college=$("#college").val();
var ban=$("#ban").val();
var tel=$("#tel").val();
if (name && password && sex && college && ban && tel) {
$.post("../conn/demo1.php",{'name':name,'password':password,'sex':sex,'college':college,'ban':ban,'tel':tel},function(data){
if (data==200) {
alert(data);
window.location.href="login.html"
}else{
alert(data);
}
});}else{
alert("请写全数据");
}
});
});
</script>
</head>
<body>
<div class="login">
<div class="message">学生信息管理系统添加界面</div>
<div id="darkbannerwrap"></div>
<!-- <form action="../conn/demo1.php" method="post"> -->
<input name="action" value="login" type="hidden">
<input name="name" placeholder="用户名" required="" type="text" id="name">
<hr class="hr15">
<input name="password" placeholder="密码" required="" type="password" id="password">
<hr class="hr15">
性别:<input type="radio" name="sex" id="sex" value="男" checked> 男
<input type="radio" name="sex" id="sex" value="女" checked> 女
<hr class="hr15">
<input id="college" name="college" placeholder="系部" required="" type="text">
<hr class="hr15">
<input id="ban" name="ban" placeholder="班级" required="" type="text">
<hr class="hr15">
<input id="tel" name="tel" placeholder="电话" required="" type="text">
<hr class="hr15">
<input value="提交" style="width:100%;" type="submit" id="but">
<hr class="hr20">
<!-- 帮助 <a onClick="alert('sxz}xhji请联系管理员')">忘记密码</a> -->
<!-- </form> -->
</div>
</body>
</html>
<?php
include_once("conn.php");
$name=$_POST["name"];
$password=$_POST["password"];
$sex=$_POST["sex"];
$college=$_POST["college"];
$ban=$_POST["ban"];
$tel=$_POST["tel"];
$sql="Insert into user(name,password,sex,college,class,tel) values ('$name','$password','$sex','$college','$ban','$tel')";
$r=mysqli_query($link,$sql);
if ($r) {
echo 200;
}else{
echo 201;
}
?>

浙公网安备 33010602011771号