<?
	session_start();
	
	$compid = $_GET['edid'];
	
	include "../../Connections/connect_mysql.php";
	
	if($compid){
		$sqle=" select * from company_tb where compid=" . $compid . "; ";
		$resulte = mysql_query($sqle) or die(mysql_error());
		$recorde=mysql_fetch_array($resulte);
		$compcode = $recorde['compcode'];
		$compnameth = $recorde['compnameth'];
		$compnameen = $recorde['compnameen'];
	}
?>
<?
	mysql_close($c);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Untitled Document</title>
  
</head>

<body>
	<div class="row">
	<div class="col-md-12">
		<form id="frmcomp" class="form-inline">
        	<div class="form-group mx-sm-3 mb-2">
    			<input type="text" class="form-control" id="comp1" placeholder="รหัสบริษัท" onBlur="javascript:chkdlgadduser(this.id);" value="<?=$compcode?>">
  			</div>
            <div class="form-group mx-sm-3 mb-2">
    			<input type="text" class="form-control" id="comp2" placeholder=" ชื่อบริษัท (THAI) " onBlur="javascript:chkdlgadduser(this.id);" value="<?=$compnameth?>">
  			</div>
            <div class="form-group mx-sm-3 mb-2">
    			<input type="text" class="form-control" id="comp3" placeholder=" ชื่อบริษัท (ENG)"  onBlur="javascript:chkdlgadduser(this.id);" value="<?=$compnameen?>">
  			</div>
            	<? if($compid){ ?>
					<button type="button" class="btn btn-primary" id="btnedit" onClick="javascript:saveeditcomp(<?=$compid?>,'comp',3);"><i class='fa fa-pencil-square-o'></i> บันทึกแก้ไขรายการ</button>
                    <button type="button" class="btn btn-danger" id="btneditcancel" onClick="javascript:canceleditcompany();"><i class='fa fa-reply-all'></i> ยกเลิกแก้ไขรายการ</button>
			   <? }else{ ?>
            		<button type="button" class="btn btn-primary" id="btnadd" onClick="javascript:addcompany('comp',3);"><i class='fa fa-plus-circle'></i> เพิ่มรายการ</button>
                <?
				}
				?>
        </form>    
    </div>
    <div class="row">
    	<div class="col-md-12">
        	<hr>
        </div>
    </div>
</div>

</body>
</html>