<?php 
include 'load.php';
if(isset($_POST['groupid']) && isset($_POST['pageid']) && isset($_POST['check'])){
	$validate_vals = array();
	$pageid = $_POST['pageid'];
	$groupid = $_POST['groupid'];
	if($_POST['check']==1){
		$validate_vals['page_id'] = $pageid;
		$validate_vals['user_group_id'] = $groupid;

        $sql = "INSERT INTO user_permissions (page_id, user_group_id)VALUES ('$pageid', '$groupid')";
        if ($conn->query($sql) === TRUE) {
            
        }
		
	}else{
		mysqli_query($conn, "DELETE FROM user_permissions WHERE user_group_id='$groupid' AND page_id='$pageid'");
	}
}


?>