forked from namastePrashant/basicCrudInPhp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
read.php
32 lines (31 loc) · 805 Bytes
/
read.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
<?php
include_once 'model.php';
$readInstantiate = new Crud;
$getData = $readInstantiate->read();
//var_dump($getData);
if(isset($_REQUEST['del_id'])){
$readInstantiate->delete($_REQUEST['del_id']);
header("location : read.php");
}
?>
<table>
<tr>
<td>S.No.</td>
<td>Name</td>
<td>Address</td>
<td>Phone</td>
<td>Gender</td>
</tr>
<?php $i = 1; ?>
<?php foreach($getData as $key => $value): ?>
<tr>
<td><?php echo $i++; ?></td>
<td><?php echo $value["name"]; ?></td>
<td><?php echo $value["address"]; ?></td>
<td><?php echo $value["phone"]; ?></td>
<td><?php echo $value["gender"]; ?></td>
<td><a href="update.php?id=<?php echo $value["id"] ;?>" >Edit</a></td>
<td><a href="read.php?del_id=<?php echo $value["id"] ;?>" >Delete</a></td>
</tr>
<?php endforeach; ?>
</table>