How to give confirmation box before deleting multiple rows in php -
i want give confirmation message before deleting multiple rows. below code. please suggest me how give confirmation message before deleting records.
$sql="select * employee"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> <td><? echo $rows['id']; ?></td> <td><? echo $rows['name']; ?></td> </tr> <?php } ?> <tr> <td><input name="delete" type="submit" id="delete" value="delete"></td> </tr> <?php if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "delete employee id='$del_id'"; $result = mysql_query($sql); } if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;url=delete_multiple.php\">"; } } ?>
create form check if form submitted, when user submits form can send request delete. if not code not run delete request?
Comments
Post a Comment