-
Notifications
You must be signed in to change notification settings - Fork 27
/
update_staff.php
182 lines (180 loc) · 6.65 KB
/
update_staff.php
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
$id=$_GET["id"];
include_once 'conn.php';
$ndate =date("Y-m-d");
$addnew=$_POST["addnew"];
$sql="select * from yuangongxinxi where id=".$id;
$query=mysql_query($sql);
?>
<script src="js/jquery-2.1.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/sweetalert.min.js" type="text/javascript" charset="utf-8"></script>
<?php
if ($addnew=="1" )
{
$number=$_POST["number"];
$name=$_POST["name"];
$address=$_POST["address"];
$card=$_POST["card"];
$time=$_POST["time"];
$price=$_POST["price"];
$age=$_POST["age"];
$job=$_POST["job"];
$remarks=$_POST["remarks"];
$sql="update yuangongxinxi set number='$number',name='$name',address='$address',card='$card',time='$time',price='$price',age='$age',job='$job',remarks='$remarks' where id= ".$id;
mysql_query($sql);
echo
"<script>
$(function(){
swal('成功','修改员工信息','success').then(() => {
location.href='check_staff.php';
})});
</script>";
}
?>
<!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" />
<title>修改员工信息</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/jquery.mCustomScrollbar.min.css" />
<link rel="stylesheet" href="css/custom.css" />
<link rel="stylesheet" href="css/demo_add.css" />
<link rel="stylesheet" href="css/font-awesome.min.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/zane-calendar.css" />
</head>
<script language="javascript">
function check(){
if(document.getElementById("name").value==""){
swal({
title: "失败!",
text: "员工姓名不能修改为空!",
icon: "error",
showConfirmButton: true
})
document.getElementById("name").focus();
return false;
}
if(document.getElementById("address").value==""){
swal({
title: "失败!",
text: "员工地址不能修改为空!",
icon: "error",
showConfirmButton: true
})
document.getElementById("address").focus();
return false;
}
if(document.getElementById("card").value==""){
swal({
title: "失败!",
text: "身份证号码不能修改为空!",
icon: "error",
showConfirmButton: true
})
document.getElementById("card").focus();
return false;
}
if(document.getElementById("time").value==""){
swal({
title: "失败!",
text: "入职时间不能修改为空!",
icon: "error",
showConfirmButton: true
})
document.getElementById("time").focus();
return false;
}
}
</script>
<body class="add_news_body">
<!--员工信息修改-->
<div class="add_news">
<div class="clearfix admin_con_top">
<h2 class="fl">员工信息修改</h2>
<p class="fr">当前日期: <?php echo $ndate; ?></p>
</div>
<div class="add_news_box">
<?php
$sql="select * from yuangongxinxi where id=".$id;
$query=mysql_query($sql);
$rowscount=mysql_num_rows($query);
if($rowscount>0)
{
?>
<form id="form1" name="form1" method="post" action="">
<ul>
<li>
<span class="user">员工工号:</span>
<input name='number' type='text' id='number' style="cursor:not-allowed" readonly value='<?php echo mysql_result($query,$i,number);?>'/> *
</li>
<li>
<span class="password">员工姓名:</span>
<input name='name' type='text' id='name' value='<?php echo mysql_result($query,$i,name);?>' autocomplete="off"/> *
<input type='text' style='display:none'> <!-- 针对firefox -->
</li>
<li>
<span class="password">家庭地址:</span>
<input name='address' type='text' id='address' value='<?php echo mysql_result($query,$i,address);?>'autocomplete="off"/> *
<input type='text' style='display:none'> <!-- 针对firefox -->
</li>
<li>
<span class="password">身份证号:</span>
<input name='card' type='text' id='card' value='<?php echo mysql_result($query,$i,card);?>' autocomplete="off"/> *
<input type='text' style='display:none'> <!-- 针对firefox -->
</li>
<li>
<span class="password">入职时间:</span>
<input name='time' type='text' id="zane-calendar" readonly value='<?php echo mysql_result($query,$i,addtime);?>' autocomplete="off" style="cursor:pointer;"/> *
<input type='text' style='display:none'> <!-- 针对firefox -->
</li>
<li>
<span class="password">员工薪资:</span>
<input name="price" type='text' id="price" value="<?php echo mysql_result($query,$i,price);?>" autocomplete="off"/></input>
<input type='text' style='display:none'> <!-- 针对firefox -->
</li>
<li>
<span class="password">员工工龄:</span>
<input name="age" type='text' id="age" value="<?php echo mysql_result($query,$i,age);?>" autocomplete="off"/></input>
<input type='text' style='display:none'> <!-- 针对firefox -->
</li>
<li>
<span class="password">员工岗位:</span>
<select name="job" type='text' id="job" value="<?php echo mysql_result($query,$i,job);?>"/> *
<option value="经理">经理</option>
<option value="厨师">厨师</option>
<option value="勤杂工">勤杂工</option>
<option value="服务员">服务员</option>
</select>
</li>
<li>
<span class="password news_ab">备注信息:</span>
<span class="none"></span>
<textarea name="remarks" id="remarks" /><?php echo mysql_result($query,$i,remarks);?></textarea>
</li>
</ul>
<div class="bottom_box">
<input type="submit" name="Submit" value="修改" onclick="return check();" >
<input type="reset" name="Submit2" value="重置"/>
<input type="hidden" name="addnew" value="1" />
</div>
</form>
<?php
}
?>
</div>
</div>
<!--员工信息修改end-->
<script src="js/zane-calendar.js" type="text/javascript" charset="utf-8"></script>
<script language="javascript">
zaneDate({
elem:'#zane-calendar',
behindTop:5,
width:258,
format: 'yyyy-MM-dd',
begintime:'2019/01/01',
})
</script>
</body>
</html>