<?php 

if(($_POST['act']== 'unpublish_departments')) {
	$id_array = $_POST['department']; // return array
	$id_count = count($_POST['department']); // count array
	
	for($i=0; $i < $id_count; $i++) {
		$id = $id_array[$i];
		$query = mysqli_query(dbc(),"UPDATE departments SET status =  1  WHERE `id` = '$id'");
		if(!$query) { die(mysql_error()); }
	}
	header("Location: gateway.php?act=view_departments&is=Successfully Unpublished"); // redirent after deleting
}
?>