<?php
$servername = "localhost";
$username = "savarnai_payment";
$password = "techno@123";
$dbname = "savarnai_payment_db";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

	$s=$_SERVER["SERVER_NAME"];
    $school_name= strstr($s, '.', true);

    $firstname=$_REQUEST['firstname'];
    $idno=$_REQUEST['idno'];

	$total_amt=$_REQUEST['total_amt'];
	$txnid=$school_name."_".$_REQUEST['txnid'];

	$amount=$_REQUEST['amount'];
	$total_amt=$_REQUEST['total_amt'];

	$cnv_amt=$_REQUEST['cnv_amt'];
	$tax=$_REQUEST['tax'];

	$pay_type=$_REQUEST['pay_type'];

	$month="[".$_REQUEST['Month']."]";

	$last_month=$_REQUEST['last_month'];

	$class=$_REQUEST['class'];

	$session=$_REQUEST['session'];
	

	
$sql = "INSERT INTO mss_pay_log (status, school_name, idno,class,name,month,pay_type,last_month,txnid,amount,fee_amt,cnv_amt,tax,device,session)
VALUES ('initiated', '$school_name', '$idno' ,'$class' ,'$firstname' ,'$month' , '$pay_type' ,'$last_month' ,'$txnid', '$amount'  ,'$total_amt', '$cnv_amt','$tax','web','$session')";

if ($conn->query($sql) === TRUE) {
         $status = 1;

 $array = array("status"=>$status,);
  echo json_encode($array);
}   
 else {
  echo "Error: " . $sql . "<br>" . $conn->error;
}







?>