








<!DOCTYPE html>
<html>
<head>

</head>
<body >

	
<?php


session_start();


$branch_key = $_SESSION['branch_key'];  
	
$q = $_GET['q'];

		
require 'config.php';

$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASS);
$database = $_SESSION['database'];
	
	
//$con = mysqli_connect('localhost','peter','abc123','my_db');
if (!$con) {
  die('Could not connect: ' . mysqli_error($con));
}

mysqli_select_db($con,$database);
$sql="SELECT * FROM product_table WHERE branch_key = $branch_key and    product_name = '".$q."'";
	//$sql="SELECT * FROM product_table WHERE customers_name = '$q'";//
$result = mysqli_query($con,$sql);

$row = mysqli_fetch_array($result) ;
	
	//$row = mysql_fetch_assoc($result) ;

//	while ( $db_found = mysqli_fetch_assoc($result) ) {
// echo  $db_found['unit_p'] .' <br>';
//	}
if($row == null){
	
	echo "product not selected";
	exit();
	
	
}

	
// echo @ $row['product_name'].'<br>';
//  echo "Unit Price:  ". @ $row['unit_p'].'<br>';
	// echo "  Avail Qty:  ". @ $row['unit_q'] ;
	
	
	
	
	if( $row['auto_manage']=="disabled"){
	
$autovalue = '';
		
		$hide = 'hidden';
	
	
}
	
	else {
		
		$autovalue =  $row['unit_q'];
		$hide = 'button';
	}

 
?>
<p></p>
									 
						<table width="100%" style ="font-size:14px" >
							
  <tbody>
	   <tr>
      <td></td>
      <td> <input type="button" value="<?php  echo @ $row['product_name'] ?>"> </td>
    </tr>  
   
    <tr>
      <td><input type="button" value="Unit Price"></td>
      <td><input type="button" value="<?php  echo @ $row['unit_p'] ?>">   </td>
    </tr>
	    <tr>
      <td><input type="<?php echo $hide ?>" value="Avail <?php echo  $row['unite'] ?> "> </td>
      <td><input type="<?php echo $hide ?>" value="<?php  echo @ $autovalue ?>">	</td>
    </tr>
	  
	    <tr>
      <td><input type="button" value="Auto Man ">  </td>
      <td><input type="button" value="<?php  echo @ $row['auto_manage'] ?>">	</td>
    </tr>
	  
	
	  
	
  </tbody>
</table>

		
	<p></p>
	
	
	<input type="hidden"  value = "<?php echo  $row['unit_p'] ?>" name="unit_p" id="unit_p">
<input type="hidden"  value = "<?php echo  $row['unit_q'] ?>" name="unit_q" id="unit_q">
	
	
	


	
	
</body>
</html>
