我正在尝试进行批量操作。我有复选框,
<input type="checkbox" name="check_id[]" value="1">
<input type="checkbox" name="check_id[]" value="2">
<input type="checkbox" name="check_id[]" value="3">
我想为每个选定的复选框从 mysql 表中选择值,然后使用我的函数根据获取的值删除数据。我试过了,
for( $i = 0; $i < count( $_POST['check_id'] ); $i++ ) {
$manufacturers_id = prepare_input($_POST['check_id'][$i]);
$manufacturer_query = mysql_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturers_id . "'");
$manufacturer = mysql_fetch_array($manufacturer_query);
delete_image(DIR_IMAGES . $manufacturer['manufacturers_image']);
}
问题是,$_POST['check_id']
即使我确定我的manufacturers_image
位置是manufacturers_id
1,2 或 3,也没有基于获取的 mysql 值。
有没有正确的方法来做到这一点?