-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeleteForm.php
51 lines (48 loc) · 1.56 KB
/
DeleteForm.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
<?php
require('mysql.php');
$q = "select * from Book";
$result = mysqli_query($conn, $q);
$num = mysqli_num_rows($result);
mysqli_close($con);
?>
<!DOCTYPE html>
<html>
<head>
<title> Delete Book Record </title>
<link rel="stylesheet" type="text/css" href="ViewStyle.css" />
</head>
<body>
<h1>Book Record Manahement</h1>
<form action="Deletion.php" method="post">
<table id = "view_table">
<tr>
<th> B_ID </th>
<th> B_Title </th>
<th> B_Price </th>
<th> B_Auther </th>
<th> B_Addition </th>
<th> Select to Delete </th>
</tr>
<?php
for ( $i = 1; $i <= $num; $i++ ) {
$row = mysqli_fetch_array($result);
?>
<tr>
<td> <?php echo $row['B_ID'] ?> </td>
<td> <?php echo $row['B_Title'] ?> </td>
<td> <?php echo $row['B_Price'] ?> </td>
<td> <?php echo $row['B_Auther'] ?> </td>
<td> <?php echo $row['B_Addition'] ?> </td>
<td> <input type="checkbox" value = "<?php echo $row['B_ID']; ?>" name="b<?php echo $i; ?>" /> </td> <!--Note in attribute 'value' we need to know which number of B_Id we are deleting to set that value we r using $row['B_ID'] see source code page --> <!--we using varible $i in 'name' attribute to change value for every row see source code of file DeleteForm.php -->
</tr>
<?php
}
?>
<tr>
<td colspan="6" > <input type="submit" value="Delete" /> </td>
</tr>
</table>
</form>
Go Back To Home Page <a style="color: blue" href="index.php">CLICK HERE</a>
</body>
</html>