As a new learner, i have some basic problems which i want to clear out. 1)i have shown student data, in tabular format. 2)in the last of below code i have provided two anchor tags. 3)among them first one redirects on update page whether the second one directly executes delete query on click without confirmation). so what i want ,when i click on delete link, browser should ask me for confirmation, if yes, then delete and redirect to login page. if no, stay on same page
>> <tr>
<td><?php echo $result['id']; ?></td>
<td><?php echo $result['sname'];?></td>
<td><?php echo $result['class']; ?></td>
<td><?php echo $result['gname'];?></td>
<td><?php echo $result['contact']; ?></td>
<td><?php echo $result['gender']; ?></td>
<td><?php echo $result['email'];?></td>
<td><?php echo $result['bloodg']; ?></td>
<td><?php echo $result['address']; ?></td>
<td><?php echo $result['division'];?></td>
<td><?php echo $result['shift']; ?></td>
<td>
<a class= "action-e" href= "update.php?id=<?php echo $result['id']; ?>"><i class="fa fa-wrench" title="Update"></i></a>
<a class= "action-d" href= "delete.php?id=<?php echo $result['id'] ?>"><i class="fa fa-trash" title="Delete"></i></a>
</td>
</tr>
CodePudding user response:
<tr>
<td><?php echo $result['id']; ?></td>
<td><?php echo $result['sname'];?></td>
<td><?php echo $result['class']; ?></td>
<td><?php echo $result['gname'];?></td>
<td><?php echo $result['contact']; ?></td>
<td><?php echo $result['gender']; ?></td>
<td><?php echo $result['email'];?></td>
<td><?php echo $result['bloodg']; ?></td>
<td><?php echo $result['address']; ?></td>
<td><?php echo $result['division'];?></td>
<td><?php echo $result['shift']; ?></td>
<td>
<a class="action-e" href="update.php?id=<?php echo $result['id']; ?>"><i class="fa fa-wrench" title="Update"></i></a>
<a class="action-d" href="delete.php?id=<?php echo $result['id'] ?>" onclick="return confirm('Are you sure?')"><i class="fa fa-trash" title="Delete"></i></a>
</td>
</tr>