Hello,
I am working on the page that will display a button for delete. Here I want some help from Javascript.
If that delete button is pressed, a message box should appear asking if the user is sure to delete the record. If the user presses Yes then the delete.php is working . If the user presses No then the user should stay in the same page.
How can I do this job? I know that it might be a simple job but I suck in JS.
I tried some codes obtained but failed to
Thanks in advance
here my code delete.php
Checkbox code:
<input name='checkbox[]' type='checkbox' id='checkbox[]' value=\"".$row['id']."\">
Browser output:
<input name='checkbox[]' type='checkbox' id='checkbox[]' value="392">
Button at the bottom of form:
<input name='delete' type='submit' id='delete' value='Delete Multiple Selected Items'>
if($delete){
//for($i=0;$i<$count;$i++){
$delete = $_REQUEST['delete'];
$checkbox = $_REQUEST['checkbox'];
$count = count($_REQUEST['checkbox']);
$del_id = $checkbox[$i];
$sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
$result = mysql_query($sql);
}
// if successful refresh page
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=checkbox.php\">";
}
mysql_close();