<?php
if(isset($_POST['name'])){
    require_once('../../assets/config/config.php');
    $obj=new Database();
    $obj->select('setting','*',null,null,null,null);
    $result=$obj->getResult();
    $s_id=$result[0]['s_id']+1;
    $batch_no=$s_id;
    $name=$_POST['name'];
    $fname=$_POST['fname'];
    $gender=$_POST['gender'];
    $mobile=$_POST['mobile'];
    $o_mobile=$_POST['o_mobile'];
    $dob=date("d-M-Y",strtotime($_POST['dob']));
    $email=$_POST['email'];
    $address=$_POST['address'];
    $date=date('d-M-Y');
    $state=$obj->insert('students',['date'=>$date,'student_id'=>$batch_no,'name'=>$name,'father_name'=>$fname,'dob'=>$dob,'address'=>$address,'email'=>$email,'o_contact_no'=>$o_mobile,'mobile_no'=>$mobile,'gender'=>$gender,'status'=>'Active']);
    if($state==1)
        {
          echo $obj->update('setting',['s_id'=>$s_id]);  
        }
  }
?>