PHP HELP PLEASE

hunk

Junior member
  • Oct 1, 2006
    282
    19
    18
    How to select and update multiple rows using checkbox in php I used below code.But it doesnt work
    <td><input type="hidden" name="id" id="id" value="<?php echo $row["file_serial_id"]; ?>" /> <input type="checkbox" name="checkbox[]" id="checkbox[]" value="<?php echo $row['file_serial_id']?>" /></td>
    if(isset($_POST['send_btn']) and $_POST['send_btn']=="Send"){
    $checkbox = isset($_POST['checkbox']) ? $_POST['checkbox'] : 0;
    $checkbox = $_POST['checkbox']; //from name="checkbox[]"
    $countCheck = count($_POST['checkbox']);
    for($i=0;$i<$countCheck;$i++){
    $del_id = $checkbox[$i];
    $sql2 = "UPDATE retained_file_mst SET mark_to_dispose=1 WHERE file_serial_id='$del_id'";
    $result2 = mysql_query($sql2,$conn);
    }
    // if successful redirect to delete_multiple.php
    if($result2){
    echo "success";
    }else{
    echo "error";
    }
    }

    Can anyone give a help ?