-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreader_info_edit.php
More file actions
74 lines (58 loc) · 2.97 KB
/
reader_info_edit.php
File metadata and controls
74 lines (58 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
session_start();
$userid=$_SESSION['userid'];
include ('mysqli_connect.php');
$sqlb="select * from reader_info where reader_id={$userid} ;";
$resb=mysqli_query($dbc,$sqlb);
$resultb=mysqli_fetch_array($resb);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>慈善管理系统 || 个人信息修改</title>
</head>
<body>
<h1 style="text-align: center"><strong>个人信息修改</strong></h1>
<div style="padding: 10px 500px 10px;">
<form action="reader_info_edit.php" method="POST" style="text-align: center" class="bs-example bs-example-form" role="form">
<div id="login">
<div class="input-group"><span class="input-group-addon">姓名</span><input value="<?php echo $resultb['name']; ?>" name="name" type="text" placeholder="请输入修改的图书名" class="form-control"></div><br/>
<div class="input-group"><span class="input-group-addon">性别</span><input value="<?php echo $resultb['sex']; ?>" name="sex" type="text" placeholder="请输入修改的作者" class="form-control"></div><br/>
<div class="input-group"><span class="input-group-addon">生日</span><input value="<?php echo $resultb['birth']; ?>" name="birth" type="text" placeholder="请输入修改的出版社" class="form-control"></div><br/>
<div class="input-group"><span class="input-group-addon">地址</span><input value="<?php echo $resultb['address']; ?>" name="address" type="text" placeholder="请输入修改的ISBN" class="form-control"></div><br/>
<div class="input-group"><span class="input-group-addon">电话</span><input value="<?php echo $resultb['telcode']; ?>" name="telcode" type="text" placeholder="请输入新的简介" class="form-control"></div><br/>
<label><input type="submit" value="确认" class="btn btn-default"></label>
<label><input type="reset" value="重置" class="btn btn-default"></label>
</div>
</form>
</div>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$nnam = $_POST["name"];
$nsex = $_POST["sex"];
$nbirth = $_POST["birth"];
$nadd = $_POST["address"];
$nint = $_POST["telcode"];
$sqla="update reader_info set name='{$nnam}',sex='{$nsex}',birth='{$nbirth}',
address='{$nadd}',telcode='{$nint}' where reader_id={$userid};";
$resa=mysqli_query($dbc,$sqla);
$sqlc="update reader_card set name='{$nnam}' where reader_id={$userid};";
$resc=mysqli_query($dbc,$sqlc);
if($resa==1&&$resc==1)
{
echo "<script>alert('修改成功!')</script>";
echo "<script>window.location.href='reader_info.php'</script>";
}
else
{
echo "<script>alert('修改失败!请重新输入!');</script>";
}
}
?>
</body>
</html>