<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$array    = '';
$zdb = $_SESSION["zdbyear_".$dbname];
mysqli_select_db($conn,$zdb);

if(isset($_REQUEST['vouchno'])){
   $mvouchno = $_REQUEST['vouchno'];
//   print "SELECT a.*, b.discount FROM `item` a, `itemgrp` b WHERE a.barcode = '$barcoden' and a.group = b.code " ;
   $iresult = mysqli_query($conn,"SELECT `name`, `lastname`, `destination`, `deptdate`, `mobile`, `email` FROM `leadenq` WHERE vouchno ='$mvouchno'") or die(mysqli_error($conn));
   //$iresult = mysqli_query($conn,"SELECT * FROM `item` WHERE name = '$itemn' ") or die(mysqli_error($conn));
   if(mysqli_num_rows($iresult) > 0){
      $array    = mysqli_fetch_array($iresult);
      
      $mobile       = $array["mobile"];
      $name         = $array["name"];
      $lastname     = $array["lastname"];
      $destination  = $array["destination"];
      $deptdate     = $array["deptdate"];
      $email        = $array["email"];
    } 
    
    header("Content-type: application\json");
    $data=array("name"=>$name,"mobile"=>$mobile,"lastname"=>$lastname,"destination"=>$destination,"deptdate"=>$deptdate,"email"=>$email);
    echo json_encode($data);
}

?>