Viewing file: FrmEdit.php (15.43 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
if (session_is_registered("valid_user"))
{
$Username = $valid_user;
include("../../include/FunctionDB.php");
include("../../include/Function.php");
//include("header.php");
ConnectDB();
$sql ="SELECT * FROM manament_tb Where code='$code'";
$result = mysql_query($sql) or die("Cannot Select").mysql_error();
$rs = mysql_fetch_array($result);
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function browse()
{
form1.Imag1.src = form1.Img1.value;
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
function chk(c){
if (c.checked){
document.all.Prob1.disabled=false;
document.all.Prob2.disabled=false;
document.all.Prob3.disabled=false;
document.all.Prob4.disabled=false;
}
else{
document.all.Problem.disabled=false;
}
}
</script>
<html>
<head>
<title>Edit accessories</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<link href="../../css/style1.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" topmargin="0">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" style="border:1px solid gray">
<tr bgcolor="#CCCCFF" >
<td height="25" colspan="3" bgcolor="#6699CC"><img src="../../Image/Manlogo.jpg" width="837" height="110"></td>
</tr>
<tr bgcolor="#CCCCFF" >
<td height="25" colspan="3"> <div align="center"><font color="#000000" size="4" face="Tahoma"><strong><font color="#FF0000">แก้ไข</font>
ข้อมูล</strong></font></div></td>
</tr>
<form name="form1" method="POST" action="EditMan.php"
enctype="multipart/form-data">
<tr bordercolor="#99CCFF">
<td bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">วันที่แจ้งซ่อม</font></div></td>
<td bgcolor="#EEEEEE"><div align="center"><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></div></td>
<td bgcolor="#EEEEEE"><font color="#000000" size="2" face="Tahoma">วันที่
<select name="mDate" id="select4" class="select" >
<?php
$Date_buy = $rs[Date_buy];
$yearthai = explode("-",$Date_buy);
$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>
เดือน
<select name="mMonth" id="select5" class="select" >
<?php
$Date_buy = $rs[Date_buy];
$yearthai = explode("-",$Date_buy);
$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>
ปี พ.ศ.
<input name="mYear" type="text" id="mYear" size="4" class="input1" value="<? echo $mYear?>" >
</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="20" bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">รายการ</font></div></td>
<td><div align="center"><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></div></td>
<td><font color="#006633" size="2" face="Tahoma">
<input name="Acc_code" type="text" id="Acc_code" value="<? echo $rs[Acc_code]?>" size="60">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="26%" bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">รหัส - อุปกรณ์/ยี่ห้อ</font></div></td>
<td width="2%" bgcolor="#EEEEEE"><div align="center"><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></div></td>
<td width="72%" bgcolor="#EEEEEE"><select name="Acc_name" id="Acc_name" class="input1">
<?php
$Acc_name = $rs[Acc_name];
$strSQL6 = "SELECT * FROM manament_tb Where code='$code' ";
$result6 = mysql_query($strSQL6);
$strSQL7 = "SELECT * FROM manament_tb ";
$result7 = mysql_query($strSQL7);
while( $rs6 = mysql_fetch_array($result6))
{
echo"<option value=\"$rs6[Acc_name]\" ><b>$rs6[Acc_code] $rs6[Acc_name]</b></option>\n";
while( $rs7 = mysql_fetch_array($result7))
{
echo"<option value=\"$rs7[Acc_name]\" ><b>$rs7[Acc_code] $rs7[Acc_name]</b></option>\n";
}
}
?>
</select></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">นักศึกษาผู้แจ้งซ่อม</font></div></td>
<td bgcolor="#EEEEEE"><div align="center"><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></div></td>
<td bgcolor="#EEEEEE"><strong><font color="#003366" size="2" face="Tahoma">
<select name="Student_id" id="Student_id" class="input1">
<?php
$Student_id = $rs[Student_id];
$sql2= "Select * From student_tb Where Student_id='$Student_id' Order by Course_code=00005 ";
$result2 = mysql_query($sql2) or die("Error Select".mysql_query());
$strSQL3 = "SELECT * FROM student_tb Where Course_code='00002' ";
$result3 = mysql_query($strSQL3);
while( $rs2 = mysql_fetch_array($result2))
{
echo"<option value=\"$rs2[Student_id]\" ><b>รุ่น $rs2[Class] No $rs2[Orderlist] - $rs2[First_name] $rs2[Name] $rs2[Lastname]</b></option>\n";
while( $rs3 = mysql_fetch_array($result3))
{
echo"<option value=\"$rs3[Student_id]\" ><b>รุ่น $rs3[Class] No $rs3[Orderlist] - $rs3[First_name] $rs3[Name] $rs3[Lastname]</b></option>\n";
}
}
?>
</select>
</font></strong></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">อาจารย์ผู้รับผิดชอบ</font></div></td>
<td><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></td>
<td bgcolor="#EEEEEE"><strong><font color="#003366" size="2" face="Tahoma">
<select name="Teacher_code" id="Teacher_code" class="input1">
<?php
$Teacher_code = $rs[Teacher_code];
$strSQL4 = "SELECT * FROM personal_tb Where Teacher_code='$Teacher_code' ";
$result4 = mysql_query($strSQL4);
$strSQL5 = "SELECT * FROM personal_tb Where Permision='2' Order by Teacher_name";
$result5 = mysql_query($strSQL5);
while( $rs4 = mysql_fetch_array($result4))
{
echo"<option value=\"$rs4[Teacher_code]\" ><b>$rs4[Teacher_name] $rs4[Teacher_lastname]</b></option>\n";
while( $rs5 = mysql_fetch_array($result5))
{
echo"<option value=\"$rs5[Teacher_code]\" ><b>$rs5[Teacher_name] $rs5[Teacher_lastname]</b></option>\n";
}
}
?>
</select>
</font></strong></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">สถานที่อุปกรณ</font></div></td>
<td> </td>
<td><input name="Store" type="text" class="input" id="Store" value="<? echo $rs[Store]?>" size="50"></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma"><font size="2">ชนิดอุปกรณ์</font> </font></div></td>
<td><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></td>
<td><font size="2" face="Tahoma">
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","Hand piece"))){echo "checked";} ?> value="Hand piece">
Hand piece
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","X-ray"))){echo "checked";} ?> value="X-ray">
X-ray
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","Air compressor"))){echo "checked";} ?> value="Air compressor">
Air compressor
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","Dental Chair"))){echo "checked";} ?> value="Dental Chair">
Dental chair
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","เครื่องขูดหินปูน"))){echo "checked";} ?> value="เครื่องขูดหินปูน">
เครื่องขูดหินปูน</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#EEEEEE"> </td>
<td><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></td>
<td bgcolor="#EEEEEE"><font size="2" face="Tahoma">
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","เครื่องฉายแสง"))){echo "checked";} ?> value="เครื่องฉายแสง">
เครื่องฉายแสง
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","Autocalve"))){echo "checked";} ?> value="Autocalve">
Autocalve
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","เครื่องปั่นอมัลกั้ม"))){echo "checked";} ?> value="เครื่องปั่นอมัลกั้ม">
เครื่องปั่นอมัลกั้ม
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","Hot air oven"))){echo "checked";} ?> value="Hot air oven">
Hot air oven
<input type="radio" name="Status" <?php if (!(strcmp("$rs[Status]","Dental unit"))){echo "checked";} ?> value="Dental unit">
Dental Unit </font></td>
</tr>
<tr bgcolor="#eeeeee">
<td> <div align="center"><font size="2" face="Tahoma">สาเหตุอาการ</font></div></td>
<td> </td>
<td bgcolor="#eeeeee">
<textarea name="Contact" cols="40" rows="5" id="Contact" class="input1"><? echo $rs[Contact]?></textarea> </td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#EEEEEE"> <div align="center"><font size="2" face="Tahoma">วันที่ซ่อมเร็จ</font></div></td>
<td> </td>
<td><font color="#000000" size="2" face="Tahoma">วันที่
<select name="mDate1" id="mDate1" class="select" >
<?php
$Date_year = $rs[Date_year];
$yearthai = explode("-",$Date_year);
$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>
เดือน
<select name="mMonth1" id="mMonth1" class="select" >
<?php
$Date_year = $rs[Date_year];
$yearthai = explode("-",$Date_year);
$mDate= intval($yearthai[2]);
$Month = intval($yearthai[1]);
$mYear = 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 ";
}
CloseDB();
// getThaiMonth();
?>
</select>
ปี พ.ศ.
<input name="mYear1" type="text" class="input" id="mYear1" value="<? echo $mYear ?>" size="4">
</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">ราคา</font></div></td>
<td> </td>
<td><input name="Price" type="text" class="input1" id="Price" value="<? echo $rs[Price]?>" size="10">
<font size="2" face="Tahoma">บาท</font></td>
</tr>
<tr bgcolor="#eeeeee">
<td><div align="center"><font size="2" face="Tahoma">ประวัติการซ่อม</font></div></td>
<td> </td>
<td><font size="2" face="Tahoma">
<textarea name="Fix_History" cols="50" rows="5" class="input1" id="Fix_History"><? echo $rs[Fix_History]?></textarea>
</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td height="22" bgcolor="#EEEEEE"> <div align="center"><font size="2" face="Tahoma">งบประมาณการซ่อมแซม</font></div></td>
<td> </td>
<td> <input name="Fix_budget" type="text" class="input1" id="Fix_budget" value="<? echo $rs[Fix_budget]?>" size="10">
<font size="2" face="Tahoma"> บาท</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">
สถานะการใช้งาน</font></div></td>
<td><font color="#FF0000" size="4" face="Tahoma"><strong>*</strong></font></td>
<td><font size="2" face="Tahoma">
<input type="radio" name="Status_1" <?php if (!(strcmp("$rs[Status_1]","ใช้งาน"))){echo "checked";} ?> value="ใช้งาน">
ใช้งาน
<input type="radio" name="Status_1" <?php if (!(strcmp("$rs[Status_1]","ว่าง"))){echo "checked";} ?> value="ว่าง">
ว่าง
<input type="radio" name="Status_1" <?php if (!(strcmp("$rs[Status_1]","ชำรุด"))){echo "checked";} ?> value="ชำรุด">
ชำรุด</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#EEEEEE"> <div align="center"><font size="2" face="Tahoma">รายการอะไหล่ที่ใช้</font></div></td>
<td> </td>
<td> <textarea name="Statistic" cols="50" rows="5" class="input1" id="Statistic"><? echo $rs[Statistic]?></textarea></td>
</tr>
<tr bgcolor="#EEEEEE">
<td bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">บันทึกซ่วยจำ</font></div></td>
<td> </td>
<td><textarea name="Description" cols="50" rows="5" id="Description" class="input1"><? echo $rs[Description]?></textarea></td>
</tr>
<tr bordercolor="#99CCFF">
<td bgcolor="#EEEEEE"><div align="center"><font size="2" face="Tahoma">รูปภาพ</font></div></td>
<td bgcolor="#EEEEEE"> </td>
<td bgcolor="#EEEEEE"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="73%"><div align="center">
<font color="#996600" size="2" face="Tahoma"></font>
<input name= "Img1" type="file" class="input" id="Img1" onChange=browse()>
</div></td>
<td width="27%"><div align="center"><img name="Imag1" src=" " width="100" height="100"></div></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#CCCCFF" >
<td height="25" colspan="3"> <div align="center">
<input name="code" type="hidden" id="code" value="<? echo $rs[code]?>">
<input type="submit" name="Submit" value=" บันทึก " class="button">
</div></td>
</tr>
</form>
</table>
</body>
</html>
<?php
}
else
{
echo"<body bgcolor=\"#CCCCCC\">";
echo"<meta http-equiv=\"refresh\" content=\"3;URL=../logout.php\" target=\"mainFrame\">\n";
echo"<center>";
echo"<br><br><br><b><font face=\"Tahoma\" size=\"4\" color=\"#FF0000\">Please Login</font> </b><br>";
echo"<br><br><font face=\"Tahoma\" size=\"10\" color=\"#000000\"> ERROR 404 PERMISION DENY</font><br>";
echo"<br><font face=\"Tahoma\" size=\"4\" color=\"#000000\"> คุณไม่มสิทธ์ใช้งาน</font>";
echo"</center>";
echo"</body>";
}
?>
|