<?php
include("../../db.php");

$status = 0;
$msg = 'Unknown error';

if (isset($_POST['student_id']) && isset($_POST['new_section'])){

    $idno        = $_POST['student_id'];
    $new_section = $_POST['new_section'];

    if ($new_section == 'NA') $new_section = "";

    $array = array("section" => $new_section);

    $flgIn = $db->updateAry("student", $array, "where idno='$idno'");

    if ($flgIn > 0) {
        $status = 1;
        $msg = 'Section updated successfully';
    } else {
        $msg = "Unable to update section...! Please try again later";
    }

}

echo json_encode(array("status" => $status, "msg" => "$msg"));