<?
	session_start();
	
	$posid = $_GET['edid'];
	
	include "../../Connections/connect_mysql.php";
	
	if($posid){
		$sqle=" select * from position_tb where posid=" . $posid . "; ";
		$resulte = mysql_query($sqle) or die(mysql_error());
		$recorde=mysql_fetch_array($resulte);
		$poscode = $recorde['poscode'];
		$posname = $recorde['posname'];
	}
?>
<?
	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="posi1" placeholder=" รหัสตำแหน่ง " onBlur="javascript:chkdlgadduser(this.id);" value="<?=$poscode?>">
  			</div>
            <div class="form-group mx-sm-3 mb-2">
    			<input type="text" class="form-control" id="posi2" placeholder=" ชื่อตำแหน่ง " onBlur="javascript:chkdlgadduser(this.id);" value="<?=$posname?>">
  			</div>
            	<? if($posid){ ?>
					<button type="button" class="btn btn-primary" id="btneditposi" onClick="javascript:saveeditposi(<?=$posid?>,'posi',2);"><i class='fa fa-pencil-square-o'></i> บันทึกแก้ไขรายการ</button>
                    <button type="button" class="btn btn-danger" id="btneditcancelposi" onClick="javascript:canceleditposi();"><i class='fa fa-reply-all'></i> ยกเลิกแก้ไขรายการ</button>
			   <? }else{ ?>
            		<button type="button" class="btn btn-primary" id="btnaddposi" onClick="javascript:addposition('posi',2);"><i class='fa fa-plus-circle'></i> เพิ่มรายการ</button>
                <?
				}
				?>
        </form>    
    </div>
    <div class="row">
    	<div class="col-md-12">
        	<hr>
        </div>
    </div>
</div>

</body>
</html>