<?php
session_start();
if (!isset($_SESSION['id'])) {
   header("location: index.php");
}
?>

<?PHP
include 'connection.php';
 set_time_limit(1000);

 $MEM_ID = $_SESSION['id'];
echo "$MEM_ID";

$sql5 = "SELECT *  FROM NAA_MEMBERS WHERE MEM_ID = '$MEM_ID '";

$parse = ociparse($conn, $sql5);
oci_execute($parse);

print_r($sql5);
while ($row = oci_fetch_assoc($parse)) {
   $user_row[] = $row;
}

 $test = $user_row[0]['PRE_DIST'];
 echo"$test";
 $P_DIV_CODE =$_POST['div_id'];



 $sql = "SELECT * FROM NAA_DISTRICT_MST WHERE DIV_CODE =".$P_DIV_CODE;
//  $sql = "SELECT * FROM BCSWN_DISTRICT WHERE DIV_ID =".$P_DIV_CODE;

 $p = ociparse($conn, $sql);
 oci_execute($p);





echo '<option value="">Select District </option>';
while ($row = oci_fetch_assoc($p)) {

	if ($row['DIST_CODE'] ==  $test ) {
		echo '<option value=' . $row['DIST_CODE'] . ' selected>' . $row['DIST_DESC'] . '</option>';
	 } else {
		echo '<option value=' . $row['DIST_CODE'] . '>' . $row['DIST_DESC'] . '</option>';
	 }
//   $output[]=$row;
}
// print($output);
// print(gettype($output));
// print json_encode($output);

oci_free_statement($p);
oci_close($conn);



?>