<?php
include("../include/Function.php");
include(
"../include/FunctionDB.php");
include(
"admin_menu.php");
 
ConnectDB();
$sql ="select * From personal_den_tb Where  Person_code='$Person_code' ";
$result mysql_query($sql);
$rs mysql_fetch_array($result);
?>
<meta http-equiv="Content-Type" content="text/html; charset=TIS-620">
<script language="JavaScript" type="text/JavaScript">
function browse()
{
form1.Imag1.src = form1.Img1.value;
}
function MM_reloadPage(init) {  //reloads the window if Na v4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->

function chk(c){
if (c.checked){
document.all.Soulmate.disabled=true;
document.all.Total_child.disabled=true;
}
else{
document.all.Soulmate.disabled=false;
document.all.Total_child.disabled=false;
}
}
var highlightcolor="lightyellow"
var ns6=document.getElementById&&!document.all
var previous=''
var eventobj
//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}

//Function to highlight form element
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}   
function handleEnter (field, event) {
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if (keyCode == 13) {
            var i;
            for (i = 0; i < field.form.elements.length; i++)
                if (field == field.form.elements[i])
                    break;
            i = (i + 1) % field.form.elements.length;
            field.form.elements[i].focus();
            return false;
        } 
        else
        return true;
    }    
</script>
<style type="text/css">
<!--
.style1 {color: #000066}
.style10 {font-size: xx-small}
.style11 {font-size: small}
.style13 {color: #000000}
.style14 {color: #FF0000}
.style17 {color: #0000FF}
.style2 {color: #000066; font-weight: bold; }
.style3 {color: #000066; font-size: 16px; }
-->
</style>
<table width="740" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td><br><fieldset>
            <legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="Frmperson.php" >หน้าหลัก</a> <img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle"><a href="EditpersonList.php">แก้ไขข้อมูลคนไข้</a></font><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle" /><a href="AccHistory.php">เพิ่มข้อมูลคนไข้</a></font></legend>
            <label><div align="center">
              <form action="EditHistory.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
                <table width="89%" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" style="border:1px solid gray">
                  <tr bordercolor="#CCCCCC" bgcolor="#CFE0F5">
                    <td colspan="3"><div align="center"><font size="4" face="Tahoma"><strong><span class="style14">แก้ไข</span></strong></font><font color="#003366" size="4" face="Tahoma"><strong> ประวัติคนไข้</strong></font></div></td>
                  </tr>
                  <tr bgcolor="#B6D0F1" background="../Image/centerpix.gif" >
                    <td height="22" colspan="3" nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><strong><font color="#003366" size="2" face="Tahoma">ประวัติส่วนตัว</font></strong></div></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td height="100%" nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">เลขที่ HN</font></div></td>
                    <td bordercolor="#CCCCCC"><font color="#FF0000" size="3" face="Tahoma">*</font></td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font color="#000000" size="2" face="Tahoma">
                      <input name="HN_code" type="text" class="d" id="HN_code" onkeypress="return handleEnter(this, event)" value="<? echo $rs[HN_code]?>" size="5" maxlength="6" />
                    </font><span class="style17"><font size="2" face="Tahoma"></font></span></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td height="100%" nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">วันที่เข้าทำการรักษา</font></div></td>
                    <td bordercolor="#CCCCCC"><font color="#FF0000" size="3" face="Tahoma"> *</font></td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font color="#000000" size="2" face="Tahoma, MS Sans Serif">วันที่ </font><font color="#000000" size="2" face="Tahoma">
                      <select name="mDate" id="select4" class="select" >
                        <?php
           $Datetype 
$rs[Datetype];
           
$yearthai explode("-",$Datetype);
           
$mDate =   intval($yearthai[2]);
           
$mMonth =  intval($yearthai[1]);
           
$mYear =   intval($yearthai[0]);
            for(
$i=0;$i<=31;$i++)
             {  
            if( 
$i == 0)
               echo
"\n\t<option value=\"$mDate\" selected>$mDate</option>\n ";
             else
               echo
"\n\t<option value=\"$i\">$i</option>\n ";
              }
                 
//    getDay1to31();
           
?>
                      </select>
                      </font><font color="#000000" size="2" face="Tahoma, MS Sans Serif"> เดือน </font><font color="#000000" size="2" face="Tahoma">
                      <select name="mMonth" id="select5" class="select" >
                        <?php
          $Datetype 
$rs[Datetype];
           
$yearthai explode("-",$Datetype);
           
$mDate=   intval($yearthai[2]);
           
$Month =  intval($yearthai[1]);
           
$mYear2=   intval($yearthai[0]);     
           
$mMonth $Month;
          
$CMonth TxtThaiMonth($Month);
           for(
$i=-1;$i<=11;$i++)
              {
             
$a $i+1;
                if( 
$a == 0)
                  echo
"\n\t<option value=\"$mMonth\" selected>$CMonth</option>\n ";
             else
                  echo
"\n\t<option value=\"$a\">$ThaiMonth[$i]</option>\n ";
              }
                 
// getThaiMonth();
          
?>
                      </select>
                      </font><font color="#000000" size="2" face="Tahoma, MS Sans Serif"> ปี พ.ศ. </font><font color="#000000" size="2" face="Tahoma">
                      <input name="mYear" type="text" class="d" id="mYear" value="<? echo $mYear?>" size="4" maxlength="4">
                    </font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#003366" size="2" face="Tahoma">เลขที่บัตรประจำตัวประชาชน</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><input name="Citizen_id" type="text" class="d" id="Citizen_id" onmouseover="ddrivetip('ช่องนี้คือเลขที่บัตรประจำตัวประชาชน 12 หลักตัวเลข','#FFE7CE', 300)"
onmouseout="hideddrivetip()" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Citizen_id]?>" size="12" maxlength="13"; />
                        <span class="style19"><font size="2" face="Tahoma">*หรือเลขที่บัตรประประกันสังคม</font></span> </td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td height="100%" nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">สถานพยาบาลผู้ประกัน</font></div></td>
                    <td bordercolor="#CCCCCC"><font color="#FF0000" size="3" face="Tahoma"> *</font></td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><input name="Hostpital" type="radio" <?php if (!(strcmp("$rs[Hostpital]","1"))){echo "checked";} ?> value="1" />
                        <span class="style19"><font size="2" face="Tahoma">ร.พ ชลบุรี
                          <input name="Hostpital" type="radio" <?php if (!(strcmp("$rs[Hostpital]","2"))){echo "checked";} ?> value="2" />
                          ร.พ เอกชล </font></span> </td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td width="23%" height="100%" nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">คำนำหน้า</font></div></td>
                    <td width="2%" bordercolor="#CCCCCC"><div align="center"><font color="#FF0000" size="3" face="Tahoma">*</font></div></td>
                    <td width="75%" nowrap="nowrap" bordercolor="#CCCCCC"><font size="2" face="Tahoma">
                      <input type="radio"  name="First_name" <?php if (!(strcmp("$rs[First_name]","นาย"))){echo "checked";} ?>  value="นาย" />
                      นาย
                      <input type="radio" name="First_name" <?php if (!(strcmp("$rs[First_name]","นางสาว"))){echo "checked";} ?> value="นางสาว" />
                      นางสาว
                      <input type="radio" name="First_name"  <?php if (!(strcmp("$rs[First_name]","นาง"))){echo "checked";} ?> value="นาง" />
                      นาง
                      <input type="radio" name="First_name" <?php if (!(strcmp("$rs[First_name]","ดช."))){echo "checked";} ?> value="ดช." />
                      ดช.
                      <input type="radio" name="First_name"  <?php if (!(strcmp("$rs[First_name]","ดญ."))){echo "checked";} ?> value="ดญ." />
                      ดญ. </font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">ชื่อ</font></div></td>
                    <td bordercolor="#CCCCCC"><div align="center"><font color="#FF0000" size="3" face="Tahoma">*</font></div></td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font size="2" face="Tahoma">
                      <input name="Name" type="text" class="d" id="Name" onkeypress="return handleEnter(this,event)" value="<? echo $rs[Name]?>" size="15" maxlength="20">
                      &nbsp;นามสกุล </font> <font size="2" face="Tahoma">
                        <input name="Lastname" type="text" class="d" id="Lastname" onkeypress="return handleEnter(this,event)" value="<? echo $rs[Lastname]?>" size="15" maxlength="20" />
                        <font color="#FF0000"> (ภาษาไทย) </font></font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#003366" size="2" face="Tahoma">วัน/เดือน/ปีเกิด</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font color="#000000" size="2" face="Tahoma, MS Sans Serif">วันที่ </font><font color="#000000" size="2" face="Tahoma">
                      <select name="mDate1" id="select4" class="select" >
                        <?php
            $DateBirth 
=$rs[DateBirth];
           
$yearthai explode("-",$DateBirth);
           
$mDate =   intval($yearthai[2]);
           
$mMonth =  intval($yearthai[1]);
           
$mYear =   intval($yearthai[0]);
            for(
$i=0;$i<=31;$i++)
             {  
            if( 
$i == 0)
               echo
"\n\t<option value=\"$mDate\" selected>$mDate</option>\n ";
             else
               echo
"\n\t<option value=\"$i\">$i</option>\n ";
              }
                 
//    getDay1to31();
           
?>
                      </select>
                      </font><font color="#000000" size="2" face="Tahoma, MS Sans Serif"> เดือน </font><font color="#000000" size="2" face="Tahoma">
                      <select name="mMonth1" id="select5" class="select" >
                        <?php
          $DateBirth
$rs[DateBirth];
           
$yearthai explode("-",$DateBirth);
           
$mDate=   intval($yearthai[2]);
           
$Month =  intval($yearthai[1]);
           
$mYear2=   intval($yearthai[0]);     
           
$mMonth $Month;
          
$CMonth TxtThaiMonth($Month);
           for(
$i=-1;$i<=11;$i++)
              {
             
$a $i+1;
                if( 
$a == 0)
                  echo
"\n\t<option value=\"$mMonth\" selected>$CMonth</option>\n ";
             else
                  echo
"\n\t<option value=\"$a\">$ThaiMonth[$i]</option>\n ";
              }
                 
// getThaiMonth();
          
?>
                      </select>
                      </font><font color="#000000" size="2" face="Tahoma, MS Sans Serif"> ปี พ.ศ. </font><font color="#000000" size="2" face="Tahoma">
                      <input name="mYear1" type="text" class="d" id="mYear1" value="<? echo $mYear?>" size="4" maxlength="4">
                    </font><font color="#000000" size="2" face="Tahoma">&nbsp; </font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC" bgcolor="#ECF5FF"><div align="center"><font color="#003366" size="2" face="Tahoma">เพศ</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font size="2">
                      <input type="radio" name="Sex" <?php if (!(strcmp("$rs[Sex]","หญิง"))){echo "checked";} ?> value="หญิง" />
                      <font color="#000000"> หญิง
                        <input type="radio" name="Sex" <?php if (!(strcmp("$rs[Sex]","ชาย"))){echo "checked";} ?> value="ชาย" />
                        ชาย</font></font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#003366" size="2" face="Tahoma">เชื้อชาติ</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><input name="Nationality" type="text" id="Nationality" value="<? echo $rs[Nationality]?>" size="10" maxlength="20" />
                        <font color="#003366" size="2" face="Tahoma">สัญชาติ
                          <input name="Nation" type="text" class="d" id="Nation" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Nation]?>" size="10" maxlength="20" />
                      </font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#003366" size="2" face="Tahoma">ศาสนา</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font size="2" face="Tahoma">
                      <input type="radio" name="Religion" <?php if (!(strcmp("$rs[Religion]","พุทธ"))){echo "checked";} ?> value="พุทธ" />
                      พุทธ
                      <input type="radio" name="Religion" <?php if (!(strcmp("$rs[Religion]","คริสต์"))){echo "checked";} ?> value="คริสต์" />
                      คริสต์
                      <input type="radio" name="Religion" <?php if (!(strcmp("$rs[Religion]","อิสลาม"))){echo "checked";} ?> value="อิสลาม" />
                      อิสลาม
                      <input type="radio" name="Religion" <?php if (!(strcmp("$rs[Religion]","อื่นๆ"))){echo "checked";} ?> value="อื่นๆ" />
                      อื่นๆ</font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#003366" size="2" face="Tahoma">อายุ</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
                      <input name="Age" type="text" class="d" id="Age" value="<? echo $rs[Age]?>" size="2" maxlength="2" />
                    </font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#003366" size="2" face="Tahoma">เลขที่บัตรประจำตัวประชาชน</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><input name="Citizen_id" type="text" class="d" id="Citizen_id" onmouseover="ddrivetip('ช่องนี้คือเลขที่บัตรประจำตัวประชาชน 12 หลักตัวเลข','#FFE7CE', 300)"
onmouseout="hideddrivetip()" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Citizen_id]?>" size="13" maxlength="13"; /></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">ภูมิลำเนา 
                      / ที่อยู่</font></div></td>
                    <td bordercolor="#CCCCCC"><font size="1" face="Tahoma">&nbsp;</font></td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC" bgcolor="#ECF5FF"><font size="1" face="Tahoma">
                      <textarea name="Address" cols="40" rows="4" class="d" onmouseover="ddrivetip('ที่อยู่ตามบัตรประจำตัวบัตรประชาชน หรือที่อยู่ปัจจุบัน','#DFDFFF', 300)";
onmouseout="hideddrivetip()"><? echo $rs[Address]?></textarea>
                    </font></td>
                  </tr>
                  <tr bgcolor="#CDDFF5">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">จังหวัด</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><strong><font color="#003366" size="2" face="Tahoma">
                      <select name="ProvinceId" id="ProvinceId" class="input1">
                        <?php
           $ProvinceId 
$rsProvinceId];
           
$strSQL2 "SELECT * FROM  province  Where   ProvinceId='$ProvinceId' ";
           
$result2 mysql_query($strSQL2);
             
$strSQL3 "SELECT * FROM  province      Order by ProvinceId";
                 
$result3 mysql_query($strSQL3);
                 while( 
$rs2 mysql_fetch_array($result2))     
                     {
                 echo
"<option value=\"$rs2[ProvinceId]\" ><b>$rs2[ProvinceName]</b></option>\n";
                  while( 
$rs3 mysql_fetch_array($result3))     
                         {
                       echo
"<option value=\"$rs3[ProvinceId]\" ><b>$rs3[ProvinceName]</b></option>\n";
                  }
                     }        
                    
// CloseDB();
            
?>
                      </select>
                    </font></strong></td>
                  </tr>
                  <tr bgcolor="#CDDFF5">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">รหัสไปรษณีย์</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><input name="Zipcode" type="text" class="d" id="Zipcode" value="<? echo $rs[Zipcode]?>" size="5" maxlength="5" /></td>
                  </tr>
                  <tr bgcolor="#CDDFF5">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">เบอร์โทรที่บ้าน</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC" bgcolor="#CDDFF5"><font color="#000000" size="2" face="Tahoma">
                      <input name="Phone" type="text" class="d" id="Phone" value="<? echo $rs[Phone]?>" size="10" maxlength="10" />
                      </font><font color="#000066" size="2" face="Tahoma">มือถือ</font><font color="#000000" size="2" face="Tahoma">
                      <input name="Mobile" type="text" class="d" id="Mobile" value="<? echo $rs[Mobile]?>" size="10" maxlength="10" />
                    </font></td>
                  </tr>
                  <tr bgcolor="#CDDFF5">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">อาชีพ</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
                      <select name="Work" class="d" id="Work" >
                        <option value="" <?php if($rs['Work']==""){ echo "selected" ; } ?>>เลือกอาชีพ</option>
                        <option value="นักเรียน/นักศึกษา" <?php if($rs['Work']=="นักเรียน/นักศึกษา"){ echo "selected" ; } ?>>นักเรียน/นักศึกษา</option>
                        <option value="ธุรกิจส่วนตัว" <?php if($rs['Work']=="ธุรกิจส่วนตัว"){ echo "selected" ; } ?>>ธุรกิจส่วนตัว</option>
                        <option value="แพทย์/พยาบาล" <?php if($rs['Work']=="แพทย์/พยาบาล"){ echo "selected" ; } ?>>แพทย์/พยาบาล</option>
                        <option value="ครู/อาจารย์" <?php if($rs['Work']=="ครู/อาจารย์"){ echo "selected" ; } ?>>ครู/อาจารย์</option>
                        <option value="นักกฎหมาย/ทนายความ" <?php if($rs['Work']=="นักกฎหมาย/ทนายความ"){ echo "selected" ; } ?>>นักกฎหมาย/ทนายความ</option>
                        <option value="คอมพิวเตอร์" <?php if($rs['Work']=="คอมพิวเตอร์"){ echo "selected" ; } ?>>คอมพิวเตอร์</option>
                        <option value="วิศวกร/ช่าง" <?php if($rs['Work']=="วิศวกร/ช่าง"){ echo "selected" ; } ?>>วิศวกร/ช่าง</option>
                        <option value="พนักงานบัญชี/การเงิน" <?php if($rs['Work']=="พนักงานบัญชี/การเงิน"){ echo "selected" ; } ?>>พนักงานบัญชี/การเงิน</option>
                        <option value="การตลาด/การขาย" <?php if($rs['Work']=="การตลาด/การขาย"){ echo "selected" ; } ?>>การตลาด/การขาย</option>
                        <option value="รับราชการ" <?php if($rs['Work']=="รับราชการ"){ echo "selected" ; } ?>>รับราชการ</option>
                        <option value="ที่ปรึกษา" <?php if($rs['Work']=="ที่ปรึกษา"){ echo "selected" ; } ?>>ที่ปรึกษา</option>
                        <option value="พนักงานรัฐวิสาหกิจ" <?php if($rs['Work']=="พนักงานรัฐวิสาหกิจ"){ echo "selected" ; } ?>>พนักงานรัฐวิสาหกิจ</option>
                        <option value="ผู้บริหาร/ผู้จัดการ" <?php if($rs['Work']=="ผู้บริหาร/ผู้จัดการ"){ echo "selected" ; } ?>>ผู้บริหาร/ผู้จัดการ</option>
                        <option value="พนักงานทั่วไป" <?php if($rs['Work']=="พนักงานทั่วไป"){ echo "selected" ; } ?>>พนักงานทั่วไป</option>
                        <option value="บริการท่องเที่ยว" <?php if($rs['Work']=="บริการท่องเที่ยว"){ echo "selected" ; } ?>>บริการท่องเที่ยว</option>
                        <option value="ออกแบบ/ดีไซน์" <?php if($rs['Work']=="ออกแบบ/ดีไซน"){ echo "selected" ; } ?>>ออกแบบ/ดีไซน์</option>
                        <option value="พนักงานโรงงาน" <?php if($rs['Work']=="พนักงานโรงงาน"){ echo "selected" ; } ?>>พนักงานโรงงาน</option>
                        <option value="นักวิชาการ/นักวิจัยค้นคว้า" <?php if($rs['Work']=="นักวิชาการ/นักวิจัยค้นคว้า"){ echo "selected" ; } ?>>นักวิชาการ/นักวิจัยค้นคว้า</option>
                        <option value="ว่างงาน" <?php if($rs['Work']=="ว่างงาน"){ echo "selected" ; } ?>>ว่างงาน</option>
                        <option value="ไม่ได้ทำงาน" <?php if($rs['Work']=="ไม่ได้ทำงาน"){ echo "selected" ; } ?>>ไม่ได้ทำงาน</option>
                        <option value="อื่นๆ" <?php if($rs['Work']=="อื่นๆ"){ echo "selected" ; } ?>>อื่นๆ</option>
                      </select>
                    </font></td>
                  </tr>
                  <tr bgcolor="#CDDFF5">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000066" size="2" face="Tahoma">การศึกษา</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC" bgcolor="#CDDFF5"><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
                      <select name="Education" class="d" id="Education"  >
                        <option selected="selected" value="" <?php if($rs['Education']==""){ echo "selected" ; } ?>>เลือกระดับการศึกษา</option>
                        <option value="ประถมศึกษา" <?php if($rs['Education']=="ประถมศึกษา"){ echo "selected" ; } ?>>ประถมศึกษา</option>
                        <option value="มัธยมศึกษาตอนต้น" <?php if($rs['Education']=="มัธยมศึกษาตอนต้น"){ echo "selected" ; } ?>>มัธยมศึกษาตอนต้น</option>
                        <option value="มัธยมศึกษาตอนปลาย"  <?php if($rs['Education']=="มัธยมศึกษาตอนปลาย"){ echo "selected" ; } ?>>มัธยมศึกษาตอนปลาย</option>
                        <option value="อาชีวศึกษา / สายอาชีพ" <?php if($rs['Education']=="อาชีวศึกษา / สายอาชีพ"){ echo "selected" ; } ?>>อาชีวศึกษา / สายอาชีพ</option>
                        <option value="ปริญญาตรี" <?php if($rs['Education']=="ปริญญาตรี"){ echo "selected" ; } ?>>ปริญญาตรี</option>
                        <option value="ปริญญาโท" <?php if($rs['Education']=="ปริญญาโท"){ echo "selected" ; } ?>>ปริญญาโท</option>
                        <option value="สูงกว่าปริญญาโท" <?php if($rs['Education']=="สูงกว่าปริญญาโท"){ echo "selected" ; } ?>>สูงกว่าปริญญาโท</option>
                      </select>
                    </font></td>
                  </tr>
                  <tr bgcolor="#CDDFF5">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center" class="style1"><font size="2" face="Tahoma">E-mail</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><input name="Email_name" type="text" class="d" id="Email_name" value="<? echo $rs[Email_name]?>" size="20" maxlength="20" /></td>
                  </tr>
                  <tr bgcolor="#CDDFF5">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#993333" size="2" face="Tahoma"><strong>ในกรณีที่เป็นเด็ก</strong></font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC">&nbsp;</td>
                  </tr>
                  <tr bgcolor="#ECF5FF" >
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font size="2" face="Tahoma">สถานภาพ 
                      บิดา - มารดา</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="43%"><font size="2" face="Tahoma">
                            <input type="radio" name="Status2" <?php if (!(strcmp("$rs[Status2]","มีชีวิตอยู่"))){echo "checked";} ?> value="มีชีวิตอยู่" />
                            มีชีวิตอยู่
                            <input type="radio" name="Status2" <?php if (!(strcmp("$rs[Status2]","ถึงแก่กรรม"))){echo "checked";} ?> value="ถึงแก่กรรม" />
                            ถึงแก่กรรม</font></td>
                          <td width="57%"><font size="2" face="Tahoma">
                            <input type="radio" name="Status3" <?php if (!(strcmp("$rs[Status3]","มีชีวิตอยู่"))){echo "checked";} ?> value="มีชีวิตอยู่" />
                            มีชีวิตอยู่
                            <input type="radio" name="Status3" <?php if (!(strcmp("$rs[Status3]","ถึงแก่กรรม"))){echo "checked";} ?> value="ถึงแก่กรรม" />
                            ถึงแก่กรรม</font></td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr bgcolor="#ECF5FF" >
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000000" size="2" face="Tahoma">ชื่อ 
                      - นามสกุล บิดา</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="45%" height="22"><font color="#000000" size="2" face="Tahoma">
                            <input name="Father_name" type="text" class="d" id="Father_name" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Father_name]?>" size="30" maxlength="30" />
                          </font><font size="2" face="Tahoma">&nbsp; </font></td>
                          <td width="55%"><font size="2" face="Tahoma">&nbsp; </font><font color="#000000" size="2" face="Tahoma">&nbsp;มารดา
                            <input name="Mother_name" type="text" class="d" id="Mother_name2" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Mother_name]?>" size="30" maxlength="30" />
                          </font></td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#000000" size="2" face="Tahoma">เบอร์โทรผู้ปกครอง</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><font color="#000000" size="2" face="Tahoma">
                      <input name="Phone_1" type="text" class="d" id="Phone_1" value="<? echo $rs[Phone_1]?>" size="10" maxlength="10" />
                      มือถือ
                      <input name="Mobile_1" type="text" class="d" id="Mobile_1" value="<? echo $rs[Mobile_1]?>" size="10" maxlength="10" />
                    </font></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font size="2" face="Tahoma">E-mail</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#CCCCCC"><input name="Email_1" type="text" class="d" id="Email_1" value="<? echo $rs[Email_1]?>" size="20" maxlength="20" /></td>
                  </tr>
                  <tr bgcolor="#B6D0F1" >
                    <td height="23" colspan="3" nowrap="nowrap" bordercolor="#CCCCCC" background="../Image/centerpix.gif"><div align="center"> </div>
                        <div align="center"></div>
                      <div align="center"><font color="#FFFFFF" size="2" face="Tahoma"><strong><font color="#003366">&nbsp;</font></strong></font> <font color="#003366"><strong><font size="2" face="Tahoma">ประวัติทางการแพทย์</font></strong></font></div></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td colspan="3" nowrap="nowrap" bordercolor="#CCCCCC"><table width="100%" border="0" cellpadding="0" cellspacing="1">
                        <tr>
                          <td>&nbsp;</td>
                          <td colspan="3"><font size="2" face="Tahoma">
                            <input type="radio" name="Degree_code" <?php if (!(strcmp("$rs[Degree_code]","โรคหัวใจ"))){echo "checked";} ?> value="โรคหัวใจ" />
                            โรคหัวใจ
                            <input type="radio" name="Degree_code"  <?php if (!(strcmp("$rs[Degree_code]","โรคเบาหวาน"))){echo "checked";} ?>  value="โรคเบาหวาน" />
                            โรคเบาหวาน
                            <input type="radio" name="Degree_code" <?php if (!(strcmp("$rs[Degree_code]","โรคเลือด"))){echo "checked";} ?> value="โรคเลือด" />
                            โรคเลือด
                            <input type="radio" name="Degree_code" <?php if (!(strcmp("$rs[Degree_code]","โรคหอบหืด"))){echo "checked";} ?> value="โรคหอบหืด" />
                            โรคหอบหืด</font></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align="center"><font size="2" face="Tahoma"> </font></div></td>
                          <td colspan="3"><font size="2" face="Tahoma">
                            <input type="radio" name="Degree_code" <?php if (!(strcmp("$rs[Degree_code]","โรคความดันโลหิตสูง"))){echo "checked";} ?> value="โรคความดันโลหิตสูง" />
                            โรคความดันโลหิตสูง
                            <input type="radio" name="Degree_code" <?php if (!(strcmp("$rs[Degree_code]","โรคไวรัสตับอักเสบ"))){echo "checked";} ?> value="โรคไวรัสตับอักเสบ" />
                            โรคไวรัสตับอักเสบ
                            <input type="radio" name="Degree_code" <?php if (!(strcmp("$rs[Degree_code]","โรคอื่นๆ"))){echo "checked";} ?> value="โรคอื่นๆ" />
                            โรคอื่นๆ ระบุ </font><font color="#003366" size="2" face="Tahoma">
                              <input name="Club_nid" type="text" class="d" id="Club_nid" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Club_nid]?>" size="30" maxlength="30" />
                            </font><font size="2" face="MS Sans Serif, Tahoma, sans-serif">&nbsp; </font></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td width="8%"><div align="center"><span class="style10"><span class="style11"><font face="Tahoma"> </font></span></span></div></td>
                          <td colspan="3"><font size="2" face="Tahoma"> ุ</font> <font size="2" face="Tahoma"><span class="style1"><span class="style10"><span class="style11"><font color="#FF0000" face="Tahoma">*</font> </span></span><span class="style13">ทันตแพทย์ผู้ทำการรักษา </span><strong><font color="#003366" size="2" face="Tahoma">
                            <select name="Teacher_code"  id="Teacher_code" class="d"  >
                              <?php
            $Teacher_code 
$rs[Teacher_code];
            
$strSQL7 "SELECT * FROM personal_tb Where  Teacher_code='$Teacher_code' ";
            
$result7 mysql_query($strSQL7);
           
$strSQL8 "SELECT * FROM  personal_tb Where  Dentis_code='01'  Order By   Teacher_code ";
             
$result8 mysql_query($strSQL8);
                 while( 
$rs7 mysql_fetch_array($result7))
                {
                echo
"<option value=\"$rs7[Teacher_code]\" ><b>$rs7[First_name]&nbsp;$rs7[Teacher_name]&nbsp; $rs7[Teacher_lastname]</b></option>\n";
                 while( 
$rs8 mysql_fetch_array($result8))
                    {
                 echo
"<option value=\"$rs8[Teacher_code]\" ><b>$rs8[First_name]&nbsp; $rs8[Teacher_name]&nbsp; $rs8[Teacher_lastname]</b></option>\n";
                }
                }
          
?>
                            </select>
                            <input name="Group_4" type="radio" value="เคยมารักษาทันตกรรม" />
                          </font></strong></span><span class="style13"><font size="2" face="Tahoma">เคยมารักษาทันตกรรม</font></span></font> <font color="#003366" size="2" face="Tahoma">&nbsp; </font> </td>
                          <td width="3%">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="22" colspan="5" background="../Image/centerpix.gif"><div align="center" class="style2"><font size="2" face="Tahoma">ประวัติการแพ้ยา </font></div></td>
                        </tr>
                        <tr>
                          <td><div align="center"></div></td>
                          <td><div align="right" class="style3">
                              <div align="center"><font size="2" face="Tahoma"> 1.แพ้ยา</font>.</div>
                          </div></td>
                          <td><font color="#000066" size="2" face="Tahoma">
                            <input name="Group_1" type="text" class="d" id="Group_1" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Group_1]?>" size="30" maxlength="30" />
                          </font></td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align="center"><font size="2" face="Tahoma"> </font></div></td>
                          <td><div align="center" class="style1"><font size="2" face="Tahoma">2.แพ้ยา</font>.</div></td>
                          <td><font color="#000066" size="2" face="Tahoma">
                            <input name="Group_2" type="text" class="d" id="Group_2" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Group_2]?>" size="30" maxlength="30" />
                          </font><font size="2" face="Tahoma">&nbsp; </font></td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align="center"><font size="2" face="Tahoma"> </font></div></td>
                          <td width="18%"><div align="center" class="style1"><font size="2" face="Tahoma">3.แพ้ยา</font>.</div></td>
                          <td width="45%"><font color="#000066" size="2" face="Tahoma">
                            <input name="Group_3" type="text" class="d" id="Group_3" onkeypress="return handleEnter(this, event)" value="<? echo $rs[Group_3]?>" size="30" maxlength="30" />
                          </font><font size="2" face="Tahoma">&nbsp; </font></td>
                          <td width="26%">&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align="center"><font size="2" face="Tahoma"> </font></div></td>
                          <td><div align="center"></div></td>
                          <td><font color="#000066" size="2" face="Tahoma">&nbsp; </font><font size="2" face="Tahoma">&nbsp; </font></td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr bgcolor="#B6D0F1">
                    <td height="21" colspan="3" nowrap="nowrap" bordercolor="#CCCCCC" background="../Image/centerpix.gif"><div align="center"><font color="#003366" size="2" face="Tahoma"></font></div></td>
                  </tr>
                  <tr bgcolor="#ECF5FF">
                    <td height="101" nowrap="nowrap" bordercolor="#CCCCCC"><div align="center"><font color="#003366" size="2" face="Tahoma">รูปภาพ</font></div></td>
                    <td bordercolor="#CCCCCC">&nbsp;</td>
                    <td nowrap="nowrap" bordercolor="#99CCFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="63%" height="100"><div align="center">
                              <input name="Img1" type="file" id="Img1" onchange="browse()" />
                          </div></td>
                          <td width="37%"><div align="center"><img src=" " name="Imag1" width="100" height="100" id="Imag1" /></div></td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr bgcolor="#CFE0F5">
                    <td height="20" colspan="3"><div align="center"> <font face="Tahoma, MS Sans Serif">
                        <input name="Person_code" type="hidden" id="Dentis_code" value="<? echo $rs[Person_code]?>" />
                        </font>
                            <input type="submit" name="Submit" value="แก้ไข" />
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div></td>
                  </tr>
                </table>
              </form>
              <br>
              <br>
            </div></label>
        </fieldset><br>
        <font color="<?php echo $GLOBALS["COLOR_FONT_3"];?>" size="2"><b>หมายเหตุ :</b> ใช้เมาส์คลิกที่ชื่อ</font></td>
    </tr>
</table>