<?
  session_start();
  
  $userid_edt = $_GET['edid'];
  
  include "../../Connections/connect_mysql.php";
  
  if($userid_edt){
		$sqle=" select * from user_tb where userid=" . $userid_edt . "; ";
		$resulte = mysql_query($sqle) or die(mysql_error());
		$recorde = mysql_fetch_array($resulte);
		$usercode = $recorde['usercode'];
		$usernameth = $recorde['usernameth'];
		$userlnameth = $recorde['userlnameth'];
		$usernameen = $recorde['usernameen'];
		$userlnameen = $recorde['userlnameen'];
		$usersex = $recorde['usersex'];
		$userposition = $recorde['userposition'];
		$userdepartment = $recorde['userdepartment'];
		$usercompany = $recorde['usercompany'];
		$userbranch = $recorde['userbranch'];
		$userloginname = $recorde['userloginname'];
		$userpassword = $recorde['userpassword'];
		$userpin = $recorde['userpin'];
		$userpicpath = $recorde['$userpicpath'];
	}
  
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Untitled Document</title>
</head>

<body>
<div class="row"><div class="col-md-12">
                       
                    	<div class="form-horizontal form-label-left">
                        
                        	<div class="form-group">
                        		<label class="control-label col-md-3 col-sm-3 col-xs-12" >รหัสพนักงาน <span class="required">*</span></label>
                        		<div class="col-md-9 col-sm-9 col-xs-12">
                          			<input id="au1" type="text" class="form-control" placeholder="รหัสพนักงาน" onblur="chkdlgadduser(this.id);" value="<?=$usercode?>" disabled >
                        		</div>
                      		</div>
                            <div class="form-group">
                        		<label class="control-label col-md-3 col-sm-3 col-xs-12" >ชื่อ (ไทย) <span class="required">*</span></label>
                        		<div class="col-md-9 col-sm-9 col-xs-12">
                          			<input id="au2" type="text" class="form-control" placeholder="ชื่อ" onblur="chkdlgadduser(this.id);" value="<?=$usernameth?>" >
                        		</div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" >นามสกุล (ไทย) <span class="required">*</span></label>
                        		<div class="col-md-9 col-sm-9 col-xs-12">
                          			<input id="au3" type="text" class="form-control" placeholder="นามสกุล" onblur="chkdlgadduser(this.id);" value="<?=$userlnameth?>">
                        		</div>
                      		</div>
                            <div class="form-group">
                        		<label class="control-label col-md-3 col-sm-3 col-xs-12" >ชื่อ (Eng) <span class="required">*</span></label>
                        		<div class="col-md-9 col-sm-9 col-xs-12">
                          			<input id="au4" type="text" class="form-control" placeholder="Name" onblur="chkdlgadduser(this.id);" value="<?=$usernameen?>">
                        		</div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" >นามสกุล (Eng) <span class="required">*</span></label>
                        		<div class="col-md-9 col-sm-9 col-xs-12">
                          			<input id="au5" type="text" class="form-control" placeholder="Last name" onblur="chkdlgadduser(this.id);" value="<?=$userlnameen?>">
                        		</div>
                      		</div>
                            <div class="form-group">
                             	<label class="control-label col-md-3 col-sm-3 col-xs-12" >เพศ</label>
                           		<div class="col-md-9 col-sm-9 col-xs-12">
                              		<label  class="radio-inline"><input id="au6" type="radio" <? if($usersex=='M'){ ?>checked="checked" <? } ?> name="optradio" value="M">ชาย</label>
									<label  class="radio-inline"><input id="au7" type="radio" <? if($usersex=='F'){ ?>checked="checked" <? } ?> name="optradio" value="F">หญิง</label>
                            	</div>
                            </div>
                            <div class="form-group">
                            	<label class="control-label col-md-3 col-sm-3 col-xs-12"><a href="javascript:;"  title="เพิ่มตำแหน่ง"><font color="#990000"><i class='fa fa-plus-circle'> ตำแหน่ง</i></font></a></label>
                                <div class="col-md-9 col-sm-9 col-xs-9">
                                	<select id="au8" class="form-control">
                            			<option value=""></option>
                                        <?
										   
											$sqls1=" select * from position_tb order by posid; ";
											$results1 = mysql_query($sqls1) or die(mysql_error());
											while($records1=mysql_fetch_array($results1)){
												$posids1 = $records1['posid'];
												$poscodes1 = $records1['poscode'];
												$posnames1 = $records1['posname'];
												
												
										?>
                            			<option value="<?=$posids1?>" <? if($userposition==$posids1) { ?> selected <? } ?>>(<?=$poscodes1?>) <?=$posnames1?></option>
										<?
											}//while
										?>
                          			</select>
                                </div>
                            </div>
                            <div class="form-group">
                            	<label class="control-label col-md-3 col-sm-3 col-xs-12" ><a href="javascript:;" onclick="javascript:;" title="เพิ่มแผนก"><font color="#990000"><i class='fa fa-plus-circle'> แผนก/ฝ่าย</i> </font></a></label>
                                <div class="col-md-9 col-sm-9 col-xs-12">
                                	<select id="au9" class="form-control">
                            			<option value=""></option>
                                        <?
										   
											$sqls2=" select * from department_tb order by dpmid; ";
											$results2 = mysql_query($sqls2) or die(mysql_error());
											while($records2=mysql_fetch_array($results2)){
												$dpmids2 = $records2['dpmid'];
												$dpmcodes2 = $records2['dpmcode'];
												$dpmnames2 = $records2['dpmname'];
												
												
										?>
                            			<option value="<?=$dpmids2?>" <? if($userdepartment==$dpmids2) { ?> selected <? } ?>>(<?=$dpmcodes2?>) <?=$dpmnames2?></option>
                            			<?
											}//while
										?>
                          			</select>
                                </div>
                            </div>
                            <div class="form-group">
                            	<label class="control-label col-md-3 col-sm-3 col-xs-12" ><a href="javascript:;" onclick="javascript:;" title="เพิ่มบริษัท"><font color="#990000"><i class='fa fa-plus-circle'> บริษัท </i></font></a></label>
                                <div class="col-md-9 col-sm-9 col-xs-12">
                                	<select id="au10" class="form-control">
                            			<option value=""></option>
                                        <?
										   
											$sqls3=" select * from company_tb order by compid; ";
											$results3 = mysql_query($sqls3) or die(mysql_error());
											while($records3=mysql_fetch_array($results3)){
												$compids3 = $records3['compid'];
												$compcodes3 = $records3['compcode'];
												$compnameths3 = $records3['compnameth'];
												
												
										?>
                            			<option value="<?=$compids3?>" <? if($usercompany==$compids3) { ?> selected <? } ?>>(<?=$compcodes3?>) <?=$compnameths3?></option>
                            			<?
											}//while
										?>
                          			</select>
                                </div>
                            </div>
                            <div class="form-group">
                            	<label class="control-label col-md-3 col-sm-3 col-xs-12" ><a href="javascript:;" onclick="javascript:;" title="เพิ่มสาขา"><font color="#990000"><i class='fa fa-plus-circle'> สาขา </i></font></a></label>
                                <div class="col-md-9 col-sm-9 col-xs-12">
                                	<select id="au11" class="form-control">
                            			<option value=""></option>
                                        <?
										   
											$sqls4=" select * from branch_tb order by branid; ";
											$results4 = mysql_query($sqls4) or die(mysql_error());
											while($records4=mysql_fetch_array($results4)){
												$branids4 = $records4['branid'];
												$brancodes4 = $records4['brancode'];
												$brannames4 = $records4['branname'];
												
												
										?>
                            			<option value="<?=$branids4?>" <? if($userbranch==$branids4) { ?> selected <? } ?>>(<?=$brancodes4?>) <?=$brannames4?></option>
                            			<?
											}//while
										?>
                          			</select>
                                </div>
                            </div>
                            <div class="form-group">
                        		<label class="control-label col-md-3 col-sm-3 col-xs-12" >Username <span class="required">*</span></label>
                        		<div class="col-md-9 col-sm-9 col-xs-12">
                          			<input id="au12" type="text" class="form-control" placeholder="Username" onblur="chkdlgadduser(this.id);" value="<?=$userloginname?>">
                        		</div>
                      		</div>
                            <div class="form-group">
                        		<label class="control-label col-md-3 col-sm-3 col-xs-12" >Password <span class="required">*</span></label>
                        		<div class="col-md-9 col-sm-9 col-xs-12">
                          			<input id="au13" type="password" class="form-control" placeholder="Password" onblur="chkdlgadduser(this.id);" value="<?=$userpassword?>">
                        		</div>
                      		</div>
                            </div>
                            
                        </div>
                        
                    </div></div>
</body>
</html>
<?
	mysql_close($c);
?>