-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_emp.php
144 lines (105 loc) · 4.04 KB
/
update_emp.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
<?php
require_once('config.php');
if( $_SERVER['REQUEST_METHOD'] == "POST"){
$id = $_GET['id'];
$email = trim($_POST['email']);
$full_name = trim($_POST['full_name']);
$age = trim($_POST['age']);
$phone = trim($_POST['phone']);
$DOB = trim($_POST['DOB']);
$address = trim($_POST['address']);
$sql = " UPDATE employee_data SET full_name= ' $full_name', email = ' $email ' , phone = ' $phone ' , DOB = '$DOB' , age= '$age' , address= '$address' WHERE emp_id = '$id'";
$result = mysqli_query($conn, $sql);
if ($result){
header("location:employee_data.php");
}
else{
echo "something went wrong" . mysqli_error($conn);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employee data</title>
<link href="css/cutomer_data.css" type="text/css" rel="stylesheet">
</head>
<body>
<style>
body {
background-color: rgb(218, 217, 238);
}
</style>
<h1>Edit Employee Details</h1>
<header>
<nav class="navbar">
<ul>
<li><a href="logout.php"> <button class="logbtn">Log out</button></a></li>
<!-- <li><a href="login page.php"> <button class="logbtn">Log in</button></a></li> -->
<li><a href="" >Reports</a></li>
<li><a href="Admin FAQs.php" >FAQs</a></li>
<li><a href="product_data.php">Product Data</a></li>
<li><a href="employee_data.php">Employee Data</a></li>
<li><a href="A-offer.php">Offers</a></li>
<li><a href="admin page.php" class="active" >Home </a></li>
<img src="img/crm-icon-png.png" alt="logo">
</ul>
</nav>
</header>
<form method="post" id="form">
<div class="form-control">
<?php
require_once "config.php";
// $email = $_SESSION["username"];
$id = $_GET['id'];
$sql = "SELECT * FROM employee_data WHERE emp_id= '$id' ";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
?>
<label for="email" id="label-email">
Employee Email
</label>
<!-- Input Type Email-->
<input type="email" id="email" name="email" placeholder="Enter email" value ="<?php echo $row['email']; ?>"/>
<br>
<label for="full_name" id="name">
Employee Name
</label>
<!-- Input Type Email-->
<input type="text" id="name" name="full_name" value ="<?php echo $row['full_name']; ?>"/>
<br>
<label for="phone" id="phone">
Employee Phone
</label>
<input type="tel" id="phone" name="phone" value ="<?php echo $row['phone']; ?>" />
<br>
<label for="age" id="name">
Employee Age
</label>
<input type="text" id="age" name="age" value ="<?php echo $row['age']; ?>"/>
<br>
<label for="DOB" id="name">
Date Of Birth
</label>
<input type="date" id="DOB" name="DOB" value ="<?php echo $row['DOB']; ?>"/>
<br>
<label for="address" id="address">
Employee Address
</label>
<input type="text" id="address" name="address" value ="<?php echo $row['address']; ?>" />
<br>
<button type="submit" value="submit" name="submit">
Update
</button>
</div>
</form>
</body>
</html>
<?php
}
}
?>