<?php
include("../db.php");
header("Access-Control-Allow-Origin: * ");
//$data ='{"class":"III","name":"asdsad","fname":"asdasd","mname":"asdasdasd","mobile":"2773737373"}';

/*
 $data;

$abc = json_decode($data);
$name=$abc->name;
$class= $abc->class;
$fname= $abc->fname;
$mname= $abc->mname;
$mobile= $abc->mobile;

*/

	$name=$_REQUEST['name'];
	$class=$_REQUEST['class'];
	$fname=$_REQUEST['fname'];
	$mname=$_REQUEST['mname'];
	$mobile=$_REQUEST['mobile'];
	
	$name=mysql_real_escape_string($name);
	$class=mysql_real_escape_string($class);
	$fname=mysql_real_escape_string($fname);
	$mname=mysql_real_escape_string($mname);
	$mobile=mysql_real_escape_string($mobile);

 
	 
	 $aryData=array(
		 "name"=>$name,
		 "class"=>$class,
		 "fname"=>$fname,
		 "mname"=>$mname,
		 "mobile"=>$mobile,
		 "school_id"=>1,
		 "session"=>'2020-2021'
	 );
 
  		$insert_complain=$db->insertAry("enquiry",$aryData);
	
	

  if($insert_complain>0){ $msg="Enquiry registered successfully, We will connect you shortly";
  
  
 
  }
	
	
	if($msg!="")
	{  
		echo json_encode(array('status' => 1, 'msg'=>'Done', "data"=>$msg));    
			
	}
	else
	{		
	 	echo json_encode(array('status' => 0, 'msg'=>'Enquiry not registerd. Please try again later..!'));
	}
