<?php 

//tab confirm delete control_boxs when ok is pressed

if(($_POST['act']== 'delete_control_boxs')) {
	$id_array = $_POST['control_box']; // return array
	$id_count = count($_POST['control_box']); // count array
	
	for($i=0; $i < $id_count; $i++) {
		$id = $id_array[$i];
		
		$query = mysqli_query(dbc(),"UPDATE controls SET status = 2, date_trashed = NOW()  WHERE `id` = '$id'");
		if(!$query) { die(mysql_error()); }
	}
	header("Location: gateway.php?act=view_control_boxs&is=Successfully deleted"); // redirent after deleting
}
?>