<?php
include("connect.php");

if (isset($_POST['value']) && $_POST['value'] != "") {

	$q = $_POST['value'];
    
	//$result = mysql_query("SELECT * FROM staff WHERE staffName = '".$q."'");
	// 
	//$row = mysql_fetch_array($result);
	
	$result1 = mysql_query("SELECT * FROM epf WHERE typeepf = 'Staff Rate'");
	 
	$row1 = mysql_fetch_array($result1);
	
	$result2 = mysql_query("SELECT * FROM epf WHERE typeepf = 'Owner Rate'");
	 
	$row2 = mysql_fetch_array($result2);
		
	$result3 = mysql_query("SELECT * FROM socso WHERE start < $q && end > $q");
	 
	$row3 = mysql_fetch_array($result3);
	
	//$salary = $row['staffSalary'];
	//$hour = $row['staffHour'];
	//$PCB = $row['staffPCB'];
	$staffrate = $row1['epfvalue'];
	$ownerrate = $row2['epfvalue'];
	$staffsocso = $row3['staffsyer'];
	$ownersocso = $row3['ownersyer'];
	
	//$arr = array(
    //'z'=>array(
    //    'age'=>33,
    //    'worktime'=>10
    //),
	//);

	$arr = array(
    $q =>array(
        'staff'=>$staffrate,
		'owner'=>$ownerrate,
		'sstaff'=>$staffsocso,
		'sowner'=>$ownersocso
		//'PCB'=>$PCB,
		//'staff'=>$staffrate,
		//'owner'=>$ownerrate
    ),
	);
	
	
    foreach($arr as $k=>$v) {
        
        if ($k == trim($q)) {
			echo $v['staff'] . '|'. $v['owner'] . '|'. $v['sstaff'] . '|'. $v['sowner'];
			//echo $v['ISBN'] . '|'. $v['price'] . '|' . $v['bad'];
        } 
    }
}
?>