<?php
session_start();

include_once('../../../db_connect/db.php');

if(isset($_SESSION['student_id'])){
	$student_id=$_SESSION['student_id'];


//get datas from the form
        $phone_no = mysqli_real_escape_string($conn_1,$_POST['phone']);
        $email = mysqli_real_escape_string($conn_1, $_POST['email']);
        $address= mysqli_real_escape_string($conn_1, $_POST['address']);
        $p_address = mysqli_real_escape_string($conn_1, $_POST['p_address']);
        $nok_name = mysqli_real_escape_string($conn_1, $_POST['g_name']);
        $nok_t = mysqli_real_escape_string($conn_1, $_POST['g_phone']);
        $nok_email= mysqli_real_escape_string($conn_1, $_POST['g_email']);
        $nok_r= mysqli_real_escape_string($conn_1, $_POST['g_relationship']);
        $nok_add = mysqli_real_escape_string($conn_1, $_POST['g_address']);





              $q = "UPDATE `hostel_students` SET  `phone_no`='$phone_no', `email`='$email',`address`='$address',`permanent_address`='$p_address',
              `guardian_name`='$nok_name', `guardian_relationship`='$nok_r', `guardian_tel`='$nok_t',
              `guardian_address`='$nok_add'

                 WHERE id = '$student_id'"; //`programme_type_applied_for`='$programme_type',


              $r = mysqli_query($conn_1, $q);

            if($r)
            {
            echo "1";

            }
            else
            {
              echo 'Contact not updated due to a system error. We apologize for any inconvenience.';


            }


   }

?>
