<?php
session_start();
if(!isset($_SESSION['aid']))
{
	echo '<script>location.href="../index.php"</script>';
}

include "../connection/config.php";

if(isset($_POST['submit']))
{
    $flag=$_POST['flag'];
    $cuid=$_POST['cuid'];

    $regno=$_POST['regno'];
    $name =strtoupper($_POST['name']);
    $class=$_POST['class'];
    $div=strtoupper($_POST['div']);
    $mob=$_POST['mob'];
    $mob2=$_POST['mob2'];

if($flag==0)
{   

  $sql="insert into customer(regno,name,class,division,mob,mob2)
        values('$regno','$name','$class','$div','$mob','$mob2')";
  $exe=mysqli_query($con,$sql);
  echo mysqli_error($exe);
  //echo '<script>location.href="customer.php"</script>';
}
if($flag==2)
{
    $sqli="update customer set regno='$regno',name='$name',class='$class',division='$div',mob='$mob',mob='$mob2' where cuid='$cuid'";  
    $exee=mysqli_query($con,$sqli);
    echo '<script>location.href="customer.php"</script>';
}
}
?>