Getting confirmation message before deleting data in php?

Dear All

I am using below script for deleting data from data base & its working fine.

I just want to add a feature in it & that is, just to show a confirmation message before deleting the data.

Is it possible???

Kindly help.




<tr bgcolor="#FDEEF4">
<th><span class="preppy2">#</span></th>
<th><span class="preppy2">ID</span></th>
<th><span class="preppy2">COL NAME</span></th>
<th><span class="preppy2">SHADE %</span></th>
<th><span class="preppy2">LAB SUB NO</span></th>
<th><span class="preppy2">LAB SUB DATE</span></th>
<th><span class="preppy2">LAB REF NO#</span></th>
<th><span class="preppy2">APVD SHADE</span></th>
<th><span class="preppy2">DYEING FACT</span></th>
<th><span class="preppy2">USE AT</span></th>
<th><span class="preppy2">BOOKING REF</span></th>
<th><span class="preppy2">REMARKS</span></th>
</tr>



<?php
while($rows=mysql_fetch_array($result)){
?>

<tr align="center">
  <td><input name="need_delete[<?php echo $rows['tbl_color_id']; ?>]" type="checkbox" id="checkbox[<?php echo $rows['tbl_color_id']; ?>]" value="<?php echo $rows['tbl_color_id']; ?>"></td>
    <td><span class="preppy3"><?php echo $rows['tbl_color_id']; ?></span></td>
      <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_color_name']); ?></span></td>
        <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_shade_percent']); ?></span></td>
         <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_ld_sub_no']); ?></span></td>
            <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_ld_sub_date']); ?></span></td>
            <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_ld_ref']); ?></span></td>
            <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_ld_shade']); ?></span></td>
              <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_dying']); ?></span></td>
                <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_fab_bkng_ref']); ?></span></td>
                 <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_useat']); ?></span></td>
                   <td><span class="preppy3"><?php echo htmlspecialchars($rows['col_color_rmks']); ?></span></td>



            </tr>
           <?php
             }
           ?>

           <tr align="center" bgcolor="#FD9003">
<td colspan="12" bgcolor="#FFE4E1">   </td>
</tr>
       <tr align="center" bgcolor="#FD9003">
        <td colspan="12" bgcolor="#A6B39D"> </td>
      </tr>

<tr align="center" bgcolor="#FD9003">
<td colspan="12" bgcolor="#FFE4E1">   </td>
</tr>


            <tr>
                <td colspan="12" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td>
            </tr>
            <?php
                // Check if delete button active, start this
                if ( ! empty($_POST['delete'])) {
                    foreach ($_POST['need_delete'] as $tbl_color_id => $value) {
                        $sql = 'DELETE FROM `'.$tbl_name.'` WHERE `tbl_color_id`='.(int)$tbl_color_id;
                        print $sql;
                        $result = mysql_query($sql);}
                       // mysql_query($sql);
                       }

                mysql_close();
            ?>
            </table>


I usually do that using Javascript, its much slicker, less code and less prone to error.

If user does not have JS turned on, just delete anyway – how much of an edge case is that going to be?