-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.php
71 lines (67 loc) · 3.97 KB
/
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
<?php
session_start();
include('includes/header.php');
include('includes/dbconnect.php');
?>
<section>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
<?php
include('includes/message.php');
?>
<div class="card">
<div class="card-header">
<h4 class="d-inline-flex flex-row">ID : <?php if (isset($_GET['id'])) {
$employee_id = $_GET['id'];
$query = "SELECT * FROM employee WHERE id='$employee_id' ";
$result = mysqli_query(mysql: $conn, query: $query); echo $employee_id;?>
<h4 class="float-end">Update</h4>
</h4>
</div>
<div class="card-body">
<?php
if (mysqli_num_rows(result: $result) > 0)
{
$employee = mysqli_fetch_array(result: $result);
?>
<form action="code.php" method="POST" enctype="multipart/form-data">
<div class="mb-3 form-group">
<input type="hidden" class="form-control" value = "<?php echo $employee['id']; ?>" name="id" id="exampleInputEmail1">
</div>
<div class="mb-3 form-group">
<label for="exampleInputEmail1" class="form-label">Employee Name</label>
<input type="text" class="form-control" value = "<?php echo $employee['name']; ?>" name="name" id="exampleInputEmail1">
</div>
<div class="mb-3 form-group">
<label for="" class="form-label">Contact</label>
<input type="number" class="form-control" value = "<?php echo $employee['phone']; ?>" name="phone" id="">
</div>
<div class="mb-3 form-group">
<label for="exampleInputEmail1" class="form-label">Email address</label>
<input type="email" class="form-control" value = "<?php echo $employee['email']; ?>" name="email" id="email">
</div>
<div class="mb-3 form-group">
<label for="exampleInputEmail1" class="form-label">Department</label>
<input type="text" class="form-control" value = "<?php echo $employee['department']; ?>" name="department" id="department">
</div>
<div class="mb-3 form-group">
<label for="" class="form-label">Image</label>
<input type="file" class="form-control" name="image" id="file">
<input type="hidden" name="image_old" value = "<?php echo $employee['image']; ?>">
<img src="<?php echo "uploads/".$employee['image']; ?>" alt="oldimage" width="70" height="auto">
</div>
<button type="submit" name="update_image" class="btn btn-primary">Update</button>
</form>
<?php
} else {
echo "NO such id found";
}
}
?>
</div>
</div>
</div>
</div>
</div>
</section>