<?php


if(($_POST['act']== 'delete_states')) {
	$id_array = $_POST['state']; // return array
	$id_count = count($_POST['state']); // count array

	for($i=0; $i < $id_count; $i++) {
		$id = $id_array[$i];
		$query = mysqli_query($dbc, "DELETE FROM `state` WHERE `id` = '$id'");
		if(!$query) { die(mysqli_error($dbc)); }
	}
	header("Location: gateway.php?act=view_states&is=Successfully Deleted"); // redient after deleting
}
?>
