-
Notifications
You must be signed in to change notification settings - Fork 1
/
emp_update.php
130 lines (118 loc) · 4.54 KB
/
emp_update.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
<?php
$NOTIFICATION=false;
include 'connect.php';
$ID=$_GET['updateid'];
$sql="SELECT * FROM `employee` WHERE `EMP_ID`='$ID'";
$result=mysqli_query($con,$sql);
$row=mysqli_fetch_assoc($result);
$EMP_ID=$row['EMP_ID'];
$NAME=$row['NAME'];
$PHONE=$row['PHONE'];
$ADDRESS=$row['ADDRESS'];
$ROLE=$row['ROLE'];
$BUS_ID=$row['BUS_ID'];
if(isset($_POST['submit'])){
$NAME=$_POST['NAME'];
$PHONE=$_POST['PHONE'];
$ADDRESS=$_POST['ADDRESS'];
$ROLE=$_POST['ROLE'];
$BUS_ID=$_POST['BUS_ID'];
$sql="UPDATE `employee` SET `EMP_ID`='$EMP_ID',`NAME`='$NAME',`PHONE`='$PHONE',`ADDRESS`='$ADDRESS',`ROLE`='$ROLE',`BUS_ID`='$BUS_ID' WHERE `employee`.`EMP_ID`='$ID'";
$result=mysqli_query($con,$sql);
if($result){
header('location:emp_display.php');
}
else{
$NOTIFICATION="<p>Bus ID does not exist<p>";
// die('Connection failed with error'.mysqli_connect_error());
}
}
?>
<!DOCTYPE html>
<html lang='en'>
<head>
<!-- Required meta tags -->
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css' rel='stylesheet'>
<link rel="shortcut icon" href="https://cdn-icons-png.flaticon.com/512/6469/6469034.png" type="image/x-icon">
<link rel="stylesheet" href="style1.css">
<title>Bus Ticket Booking</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="index.php"><strong><img src="https://cdn-icons.flaticon.com/png/512/3066/premium/3066259.png?token=exp=1643485325~hmac=761a3a37424b1bb74ee71f64a4e63f98" width="35px">Bus Ticket Booking</strong></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link" aria-current="page" href="display.php">Bus</a>
<a class="nav-link active" href="emp_display.php">Employee</a>
<a class="nav-link" href="routes_display.php">Routes</a>
<a class="nav-link" href="cust_display.php">Customers</a>
<a class="nav-link" href="ticket_display.php">Ticket</a>
</div>
</div>
</div>
</nav>
<div class='container my-5'>
<form action='' method='post'>
<!-- <div class='mb-3'>
<label for='BUS_ID' class='form-label'>BUS ID</label>
<input type='text' class='form-control' id='BUS_ID' name='BUS_ID' placeholder='Enter the Bus ID'
autocomplete='off' value=<?php
echo $BUS_ID;
?>
>
<p>Don't give duplicate values</p>
</div>-->
<div class='mb-3'>
<label for='NAME' class='form-label'>NAME</label>
<input type='text' class='form-control' id='NAME' name='NAME' placeholder='Enter the name'
autocomplete='off'value=<?php
echo $NAME;
?>
>
</div>
<div class='mb-3'>
<label for='PHONE' class='form-label'>PHONE</label>
<input type='text' class='form-control' id='PHONE' name='PHONE' pattern="[6-9]{1}[0-9]{9}" placeholder='Enter the phone number'
autocomplete='off' value=<?php
echo $PHONE;
?>
>
</div>
<div class='mb-3'>
<label for='ADDRESS' class='form-label'>ADDRESS</label>
<input type='text' class='form-control' id='ADDRESS' name='ADDRESS'
placeholder='Enter the address' autocomplete='off' value=<?php
echo $ADDRESS;
?>
>
</div>
<div class='mb-3'>
<label for='ROLE' class='form-label'>ROLE</label>
<input type='text' class='form-control' id='ROLE' name='ROLE'
placeholder='Enter the role' autocomplete='off' value=<?php
echo $ROLE;
?>
>
</div>
<div class='mb-3'>
<label for='BUS_ID' class='form-label'>BUS_ID</label>
<input type='text' class='form-control' id='BUS_ID' name='BUS_ID'
placeholder='Enter the bus id' autocomplete='off' value=<?php
echo $BUS_ID;
?>
>
</div>
<?php
echo "$NOTIFICATION";
?>
<div><button type='submit' class='btn btn-primary' name='submit'>Update</button></div>
</form>
</div>
</body>
</html>