<?php include ("connection/dbconn.php") ; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>แก้ไขข้อมูลการ ยืม - คืน</title> <style type="text/css"> . stylel { color: #808000; font-weight: bold; } body { background-color: #CCC; background-image: url(pix/12339327_992279087476885_3475781144932680010_o.jpg); background-position : center top; background-attachment : fixed } body p { font-family: "Segoe UI"; } body p { font-family: "TH SarabunPSK"; font-size: 24px; } #formupdate div table tr .stylel div { font-size: 24px; } #formupdate div table { font-size: 24px; font-family: "TH SarabunPSK"; } .from8 { font-size: large; } .from2 { font-size: 45px; } .from2 strong { } #formupdate h5 font { font-size: 24px; font-family: "TH SarabunPSK"; } .from2 strong { font-family: "TH SarabunPSK"; } #formupdate div table tr td font { font-size: 16px; } #formupdate div table tr td font { font-size: 18px; } </style> <?php if (isset ($_POST['submit'])) { process_update() ; } else { show_form(array()); } ?> <?php function show_form() { $bor_id = $_GET['bor_id'] ; $query = "select * from bor where bor_id = '{$bor_id}' "; $result = mysql_query($query) or die (mysql_error()) ; $row_result = mysql_fetch_array($result); ?> <h2 align="center"><img src="pix/12375822_992992337405560_1307443744_o (1).jpg" width="980" height="200"></h2> <div align="center"> <?php ?> </div> <form id="formupdate" name="formupdate" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <div align="center"> <table width="29%" height="189" border="1" cellpadding="1" cellspacing="1"> <tr> <td width="40%" class="stylel"><div align="right"><strong>รหัสใบยืม : </strong></div></td> <td width="60%"><font color="red"> <? ?> <?php echo $row_result['bor_id']; echo $_POST['bor_id'];?></td> <? ?> <input type = "hidden" name = "teacher_id" value= "<? if (isset($_POST['bor_id'])) echo $_POST['bor_id']; else echo $row_result['bor_id']; ?>" /> </tr> <tr> <td class="stylel"><div align="right"><strong>รหัสอุปกรณ์ <font color ="red">*</font> :</strong></div></td> <? ?> <td> <input name = "dev_id" type = "text" size="10" maxlength="5" value= "<? echo $_POST['dev_id']; echo $row_result['dev_id']; ?>" /></td> <br> </tr> <tr> <td class="stylel"><div align="right"><strong>รหัสครู <font color ="red">* </font>: </strong></div></td> <? ?> <td> <input name = "teacher_id" type = "text" size="10" maxlength="8" value= "<? echo $_POST['teacher_id']; echo $row_result['teacher_id']; ?>" /></td> </tr> <tr> <td class="stylel"><div align="right"><strong>รหัสเจ้าหน้าที่ <font color ="red">*</font> : </strong></div></td> <? ?> <td><input name = "officer_id" type = "text" size="10" maxlength="8" value= "<? echo $_POST['officer_id']; echo $row_result['officer_id']; ?>" /></td> </tr> <tr> <td class="stylel"><div align="right"><strong>วันที่ยืม <font color ="red">*</font> : </strong></div></td> <? ?> <td><input name = "date_of_borrow" type = "text" size="15" maxlength="10" value= "<? echo $_POST['date_of_borrow']; echo $row_result['date_of_borrow']; ?>" /> <font color = "red">* YYYY-MM-DD</font></td> </tr> <tr> <td class="stylel"><div align="right"><strong>กำหนดวันที่คืน <font color ="red">*</font> : </strong></div></td> <? ?> <td><input name = "due_date" type = "text" size="15" maxlength="10" value= "<? echo $_POST['due_date']; echo $row_result['due_date']; ?>" /> <font color = "red">* YYYY-MM-DD</font></td> </tr> <tr> <td class="stylel"><div align="right"><strong>สภาพอุปกรณ์ <font color ="red">*</font> : </strong></div></td> <? ?> <td><input name = "borrow_check" type = "text" size="30" maxlength="50" value= "<? echo $_POST['borrow_check']; echo $row_result['borrow_check']; ?>" /></td> </tr> <tr> <td class="stylel"><div align="right"><strong>ผลการอนุมัติ :</strong></div></td> <td><select name="status"> <?php if (isset($_POST['status'])) $dev_type_id=$_POST['status']; else $dep_id=$row_result['status']; ?> <? ?> <option value = "รอการอนุมัติ" <?php if($status == "รอการอนุมัติ") echo "selected"?> >รอการอนุมัติ</option> <option value = "กำลังยืม" <?php if($status == "กำลังยืม") echo "selected"?> >กำลังยืม</option> <option value = "นำมาคืนแล้ว" <?php if($status == "นำมาคืนแล้ว") echo "selected"?> >นำมาคืนแล้ว</option> </select></td> </tr> </table> </div> <h5 align="center"><font color = "red">* คือฟิลด์ที่ต้องป้อนข้อมูล ห้ามปล่อยว่าง</font></h5> <div align="center"> <input name="submit" type="submit" value="Save"/> <input name="reset" type="reset" value="Reset"/> </div> </form> <div align="center"> </p> <div align="center"> <?php } function process_update() { $bor_id = $_POST['bor_id']; $teacher_id = trim($_POST['teacher_id']); $dev_id = trim($_POST['dev_id']); $status = trim($_POST['status']); $officer_id = trim($_POST['officer_id']); $borrow_check = trim($_POST['borrow_check']); $date_of_borrow = trim($_POST['date_of_borrow']); $due_date = trim($_POST['due_date']); $bor_id = addslashes($bor_id); $teacher_id = addslashes($teacher_id); $dev_id = addslashes($dev_id); $status = addslashes($status); $officer_id = addslashes($officer_id); $borrow_check = addslashes($borrow_check); $date_of_borrow = addslashes($date_of_borrow); $due_date = addslashes($due_date); $query_book2 = "update bor set teacher_id='{$teacher_id}',dev_id='{$dev_id}',status='{$status}',officer_id='{$officer_id}',borrow_check='{$borrow_check}',date_of_borrow='{$date_of_borrow}',due_date='{$due_date}' where bor_id='{$bor_id}' "; $result2 = mysql_query($query_book2) or die (mysql_error()); echo "<center><h3><span class=\"stylel\">ผลการแก้ไขข้อมูล</span></h3></center>\n"; if($result2) { echo "<center>แก้ไขข้อมูลในฐานข้อมูลเรียบร้อยแล้ว</center>"; } else { echo "<font color = \"red\">ไม่สามารถแก้ไขข้อมูลในฐานข้อมูลได้</font><br>"; } ?> </div> <p align="center"><a href="borrow_off_show.php">BACK</a></p> <div align="center"> <p> <?php } mysql_close($dbconn); ?> </p> <p><img src="pix/12371140_992285694142891_1164893728129279885_o.jpg" alt="" width="1014" height="80" /></p> </div> </body></html>
echo $query_book2;
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง