-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstaffadd.php
203 lines (119 loc) · 4.03 KB
/
staffadd.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php
require_once('function.php');
dbconnect();
session_start();
if (!is_user()) {
redirect('index.php');
}
?>
<?php
$user = $_SESSION['username'];
$usid = $pdo->query("SELECT id FROM users WHERE username='".$user."'");
$usid = $usid->fetch(PDO::FETCH_ASSOC);
$uid = $usid['id'];
include ('header.php');
?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Add Staff</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-10 col-md-offset-1">
<?php
if($_POST)
{
$stafftype = $_POST["stafftype"];
$fullname = $_POST["fullname"];
$address = $_POST["address"];
$phonenumber = $_POST["phonenumber"];
$salary = $_POST["salary"];
///////////////////////-------------------->> Catid ki 0??
$error = 0;
if($stafftype==0)
{
$err1=1;
}
if(isset($err1))
$error = $err1;;
if (!isset($error) || $error == 0){
$res = $pdo->exec("INSERT INTO staff SET stafftype='".$stafftype."', fullname='".$fullname."', address='".$address."', phonenumber='".$phonenumber."', salary='".$salary."'");
if($res){
echo "<div class='alert alert-success alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
Staff Added Successfully!
</div>";
}else{
echo "<div class='alert alert-danger alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
Some Problem Occurs, Please Try Again.
</div>";
}
} else {
if (!isset($err1) || $err1 == 1){
echo "<div class='alert alert-danger alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
Please select a Category!!!!
</div>";
}
}
}
?>
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<form action="staffadd.php" method="post">
<div class="form-group">
<label>Select Staff Designation</label>
<select name="stafftype" class="form-control" style="width:200px; height: 40px;">
<option value="0">Please Select a Staff Designation</option>
<?php
$ddaa = $pdo->query("SELECT id, title FROM stafftype ORDER BY id");
while ($data = $ddaa->fetch(PDO::FETCH_ASSOC))
{
echo "<option value='$data[id]'>$data[title]</option>";
}
?>
</select><br/>
</div>
<div class="form-group">
<label>Full Name</label><br/>
<input type="text" name="fullname" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label>Address</label><br/>
<input type="text" name="address" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label>Phone Number</label><br/>
<input type="text" name="phonenumber" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label>Salary</label><br/>
<?php echo($currency);?><input type="text" name="salary" style="width:200px; height: 40px;" /><br/><br/>
</div>
<input type="submit" class="btn btn-lg btn-success btn-block" value="ADD">
</form>
</div>
</div>
<!-- /.row -->
</div>
<!-- /#page-wrapper -->
<script src="js/bootstrap-timepicker.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery("#ssn").mask("999-99-9999");
// Time Picker
jQuery('#timepicker').timepicker({defaultTIme: false});
jQuery('#timepicker2').timepicker({showMeridian: false});
jQuery('#timepicker3').timepicker({minuteStep: 15});
});
</script>
<?php
include ('footer.php');
?>