-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
86 lines (77 loc) · 2.69 KB
/
index.php
File metadata and controls
86 lines (77 loc) · 2.69 KB
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
<!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>Document</title>
<style>
.container{
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 3em;
}
.form__container{
width: 100%;
}
.form__div{
display: flex;
flex-direction: column;
margin-bottom: 1rem;
}
</style>
</head>
<body>
<?php
include './config/config.php';
$sql = "SELECT * FROM departments";
$query = mysqli_query($conn, $sql);
?>
<div class="container">
<div class="form__container">
<form action="./controller/controller.php" method="POST">
<div class="form__div">
<label for="">Department Name</label>
<input type="text" name="department_name" id="">
</div>
<div class="form__div">
<label for="">Manager ID</label>
<input type="text" name="manager_id" id="">
</div>
<div class="form__div">
<label for="">Location ID</label>
<input type="text" name="location_id" id="">
</div>
<button type="submit" name="new_record">submit</button>
</form>
</div>
<div class="table__container">
<table>
<thead>
<tr>
<th>ID</th>
<th>Department Name</th>
<th>Manager ID</th>
<th>Location ID</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php while($row = $query->fetch_assoc()) { ?>
<tr>
<td><?php echo $row['department_id'] ?></td>
<td><?php echo $row['department_name'] ?></td>
<td><?php echo $row['manager_id'] ?></td>
<td><?php echo $row['location_id'] ?></td>
<td>
<a href="./page/updatePage.php?ID=<?php echo $row['department_id'] ?>" .;>Update</a>
<a href="./controller/controller.php?ID=<?php echo $row['department_id'] ?>">Delete</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</body>
</html>