<?php ob_start(); session_start(); require_once("connect.php"); $login=$_SESSION['login']; if($login<>"OK")//ป้องกันการเข้าเมนูโดนไม่่ผ่านหน้าlogin { ?> <script language="javascript"> alert("คุณไม่สามารถใช่ส่วนนี้ได้ กรุณาล๊อกอินก่อน"); </script> <?php header("location:login.php"); } //แก้ไขข้อมูล $status=""; $type=""; $roomnum=""; $price=""; if(isset($_GET['stat']) and $_GET['stat']=='edit') { $roomid=$_GET['roomid']; $sql="select * from tblroom where roomid='$roomid'"; $room=mysql_query($sql); if(mysql_num_rows($room)==1) { $r=mysql_fetch_array($room); $roomnum=$r['roomnum']; $roomdetail=$r['roomdetail']; $type=$r['roomtype']; $status=$r['status']; $price=$r['price']; $pname=$r['pic']; $chkstat="edit"; } } else { $chkstat="add";} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>บ้านพัก</title> <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" /> <link rel="stylesheet" href="css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" /> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.validationEngine.js" type="text/javascript"></script> </head> <body> <div align="center"><img src="Text_Web/text-editroom.png" width="230" height="60"></div> <form action="fun_room.php?stat=<?php echo $chkstat;?>" method="post" enctype="multipart/form-data"> <input type="hidden" name="stat" value="<?php echo $chkstat; ?>"> <input type="hidden" name="id" value="<?php echo $roomid; ?>"> <table> <tr> <td width="111"><img src="Text_Web/text-numroom.png" alt="" width="81" height="32" /></td> <td colspan="6"><input class="validate[required,custom[onlyNumber],length[0,3]] text-input" type="text" readonly="readonly" name="txtroomnum" value="<?php echo $roomnum; ?>"></td> </tr> <tr> <td><img src="Text_Web/text-typeroom.png" alt="" width="93" height="31" /></td> <?php $type1=''; $type2=''; if($type=="1") {$type1="checked=checked";} if($type=="2") {$type2="checked=checked";} ?> <td width="20"> <input class="validate[required] radio" type="radio" name="roomtype" value="1" <?php echo $type1; ?> /></td> <td width="62"><img src="Text_Web/text-bedsingle.png" alt="" width="65" height="31" /></td> <td width="20"><input class="validate[required] radio" type="radio" name="roomtype" value="2" <?php echo $type2; ?> /></td> <td width="47"><img src="Text_Web/text-bedtwin.png" alt="" width="47" height="31" /></td> <td colspan="2"> </td> <tr> <td><img src="Text_Web/text-detailroom.png" alt="" width="111" height="31" /></td> <td colspan="6"> <textarea name="txtdetail"><?php echo $roomdetail; ?></textarea></td> </tr> <tr> <td><img src="Text_Web/text-statusthai.png" alt="" width="40" height="33" /></td> <?php $stat1=''; $stat2=''; $stat3=''; if($status=="1") {$stat1="checked=checked";} if($status=="2") {$stat2="checked=checked";} if($status=="3") {$stat3="checked=checked";} ?> <td><input class="validate[required] radio" type="radio" name="roomstat" value="1" <?php echo $stat1; ?>></td> <td><img src="Text_Web/text-roomemply.png" width="45" height="31" /></td> <td><input class="validate[required] radio" type="radio" name="roomstat" value="2" <?php echo $stat2; ?> /></td> <td><img src="Text_Web/text-roomre.png" width="39" height="33" /></td> <td width="20"><input class="validate[required] radio" type="radio" name="roomstat" value="3" <?php echo $stat3; ?> /></td> <td width="45"><img src="Text_Web/text-roomfull.png" width="45" height="31" /></td> </tr> <tr> <td><img src="Text_Web/text-price.png" alt="" width="35" height="33" /></td> <td colspan="6"><input class="validate[required,custom[onlyNumber],length[0,4]] text-input"type="text" name="txtprice" value="<?php echo $price; ?>"></td> </tr> <tr> <td><img src="Text_Web/text-picexroom.png" alt="" width="111" height="31" /></td> <td colspan="6"><input type="file" name="txtfile" value="<?php echo $pname; ?>"></td> </tr> <tr> <td><input type="submit" value="บันทึก" name="btnsave"> <input type="reset" value="ยกเลิก" name="btncancal"></td> </tr> </table> </form> </body> </html>
if(txtfile != ""){ //ทำการอัพเดตทั้งหมดทั้งข้อควมและรูปภาพ } else{ //ทำการอัพเดตตัวอื่นแต่รูปไม่ต้องอัพเตดไงครับ }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง