<?php 

//tab confirm delete users delete users when ok is pressed

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