I want delete several row together with foreach
, but i have this output bool(false) not array
from following code. how is fix it?
<input type="checkbox" name="checked[]" value="1">
function delete_test()
{
$delete = $this->input->post('checked');
if (is_array($delete) && count($delete) > 0) {
foreach ($delete as $val) {
$this->db->query("DELETE FROM hotel_units WHERE relation LIKE '$val'");
}
var_dump($delete);
echo "<br>is array";
} else {
var_dump($delete);
echo "<br>not array";
} // This output is: bool(false) not array
}