-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathupdatemployee.php
147 lines (147 loc) · 4.78 KB
/
updatemployee.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
<?php include('configall.php')
$sql="SELECT Employee_id,Name,Email,salary,loan,jobtitle,Depart_id,pfund FROM `employee`;";
$result=mysqli_query($connection,$sql);
if(isset($_GET['edit'])){
$id = $_GET['edit'];
echo $id;
$rec = mysqli_query($connection, "SELECT * FROM employee WHERE Employee_id=$id;");
$record=mysqli_fetch_array($rec);
$name=$record['Name'];
$dob=$record['dob'];
$gender=$record['gender'];
$sdate=$record['Start_date'];
$email=$record['Email'];
$phone=$record['Phone_no'];
$loan=$record['loan'];
$pfund=$record['p_fund'];
$jobtitle=$record['jobtitle'];
$address=$record['Address'];
$depid=$record['Depart_id'];
if($record['managesDepart_id']==null)
{
$manid=0;
}
else
{
$manid=$record['managesDepart_id'];
}
$bacc=$record['bank_accno'];
}
?>
<!DOCTYPE html>
<html>
<title>Update Employee</title>
<body>
<div class="w3-container" style="padding: 50px 200px 20px 200px">
<form class="w3-container" action="em-updatephp.php" method="post">
<p>
<input class="w3-input w3-light-grey w3-animate-input" type="hidden" name="empid" value="<?php echo $id;?>"></p>
<p>
<label>Name</label>
<input class="w3-input w3-light-grey w3-animate-input" type="text" name="name" value="<?php echo $name;?>">
</p>
<p>
<label>Date of Birth</label>
<input class="w3-input w3-light-grey w3-animate-input" type="date" name="dob" value="<?php echo $dob;?>">
</p>
<p>
<label>Gender</label><br>
<?php
if ($gender=='male')
{
?><input type="radio" name="gender" value="male" checked> Male
<input type="radio" name="gender" value="female"> Female<br></p>
<?php
}else
{
?>
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female" checked> Female<br></p><?php
}
?>
</p>
<p>
<label>Joining date</label>
<input class="w3-input w3-light-grey w3-animate-input" type="date" name="sdate" value="<?php echo $sdate;?>">
</p>
<p>
<label>Email</label>
<input class="w3-input w3-light-grey w3-animate-input" type="email" name="email" value="<?php echo $email;?>"></p>
<p>
<label>Phone</label>
<input class="w3-input w3-light-grey w3-animate-input" type="text" name="phone" value="<?php echo $phone;?>"></p>
<p>
<label>Loan</label>
<input class="w3-input w3-light-grey w3-animate-input" type="number" name="loan" value="<?php echo $loan;?>"></p>
<p>
<label>Provident fund
</label>
<input class="w3-input w3-light-grey w3-animate-input" type="number" name="pfund" value="<?php echo $pfund;?>"></p>
<p><label>Bank Account No</label>
<input class="w3-input w3-light-grey w3-animate-input" type="number" name="bacc" value="<?php echo $bacc;?>"></p>
<label>Jobtitle</label>
<?php
if ($jobtitle=='executive')
{
?> <select class="w3-input w3-light-grey w3-animate-input" name="jobtitle">
<option value="executive">Executive</option>
<option value="manager">Manager</option>
<option value="director">Director</option>
<option value="accountant">Accountant</option>
<option value="chief">Chief</option></select>
<?php
}else if($jobtitle=='manager')
{
?>
<select class="w3-input w3-light-grey w3-animate-input" name="jobtitle">
<option value="executive">Executive</option>
<option value="manager" selected>Manager</option>
<option value="director">Director</option>
<option value="accountant">Accountant</option>
<option value="chief">Chief</option></select>
<?php
}else if($jobtitle=='director')
{
?>
<select class="w3-input w3-light-grey w3-animate-input" name="jobtitle">
<option value="executive">Executive</option>
<option value="manager">Manager</option>
<option value="director" selected>Director</option>
<option value="accountant">Accountant</option>
<option value="chief">Chief</option></select>
<?php
}else if($jobtitle=='chief')
{
?>
<select class="w3-input w3-light-grey w3-animate-input" name="jobtitle">
<option value="executive">Executive</option>
<option value="manager">Manager</option>
<option value="director">Director</option>
<option value="accountant">Accountant</option>
<option value="chief" selected>Chief</option></select>
<?php
}else
{
?> <select class="w3-input w3-light-grey w3-animate-input" name="jobtitle">
<option value="executive">Executive</option>
<option value="manager">Manager</option>
<option value="director">Director</option>
<option value="accountant" selected>Accountant</option>
<option value="chief">Chief</option></select>
<?php
}
?>
<p>
<label>Address</label>
<input class="w3-input w3-light-grey w3-animate-input" type="text" name="address" value="<?php echo $address;?>">
</p>
<p><label>Employee Department</label>
<input class="w3-input w3-light-grey w3-animate-input" type="number" name="depid" value="<?php echo $depid;?>"></p>
<p><label>Managing Department</label>
<input class="w3-input w3-light-grey w3-animate-input" type="number" name="manid" value="<?php echo $manid;?>"></p>
<input type="submit" value="Update" class="w3-input w3-green w3-round-xxlarge w3-animate-input w3-hover-blue">
</form>
</div>
</div>
</body>
</html>