<? ob_start(); session_start(); if($_SESSION["adminlogin"]=="") { header('location:index.php'); exit(); } //============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล require_once('../connect/connect.php'); require_once('../connect/function.php'); //=========== กรณีมีการแก้ไขรายการสินค้า if($_GET["Action"]=="Save") { //=========== บันทึกข้อมูลสินค้า $sql_up = "update product set ProductCode='$_POST[txtProductCode]', ProductName='$_POST[txtProductName]', Description='$_POST[txtDescription]',Price='$_POST[txtPrice]' ,PriceNormal='$_POST[txtPriceNormal]',PriceSend='$_POST[txtPriceSend]', Stock='$_POST[txtStock]',Promotion='$_POST[rdoPromotion]', New='$_POST[rdoNew]' where ProductID='$_GET[ProductID]'"; $dbquery_up = mysql_query($sql_up); //echo $sql_up; // exit(); //=========== แก้ไขไฟล์เล็ก if(!empty($file)) { $path="../picture"; //=========== อัพโหลตไฟลืเล็ก @copy( $file ,"$path/$file_name"); $sql_up = "update product set Picture='$file_name' where ProductID='$_GET[ProductID]'"; $dbquery_up = mysql_query($sql_up); } echo"<script language='JavaScript'>"; echo"alert('แก้ไขข้อมูลเรียบร้อยแล้ว');"; echo"window.location='editproduct.php?ProductID=$_GET[ProductID]';"; echo"</script>"; } ?> <html> <title>..:: ระบบจัดการฐานข้อมูล ::</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="../css/styles.css" type="text/css"> <script language="JavaScript" src="editor.js"></script> <div align="center"><br> <? //=========== อ่านว่าคือสินค้าชนิดใด $result=select("product","where 1=1 and ProductID='".$_GET["ProductID"]."'"); if(!$result) { header("location:product.php"); } ?> <table cellspacing=1 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10"> <tbody> <tr bgcolor=#e5e5e5> <td width="100%" bgcolor="#FFFFFF"> <div align="center"></div> <table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10"> <tbody> <tr bgcolor=#e5e5e5> <td width="35%" bgcolor="#FFFFFF"> <div align="left"><b><img src="../image/allrowto.gif" width="11" height="11" align="absbottom"> แก้ไขรายการสินค้า</b></div></td> <td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left"> </div></td> <td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="product.php?CatID=<?=$result["CatID"];?>">กลับไป</a></div></td> </tr> </tbody> </table></td> </tr> </tbody> </table> </div> <form name="frm<?=$i;?>" method="post" action="<?=$_SERVER['PHP_SELF'];?>?ProductID=<?=$_GET["ProductID"];?>&Action=Save" enctype="multipart/form-data" onSubmit="return checkvalue()"> <table cellspacing=1 cellpadding=3 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10"> <tbody> <tr bgcolor=#e5e5e5> <td width="31" bgcolor="#FFFFFF"> <script language="Javascript1.2"><!-- // load htmlarea _editor_url = ""; // URL to htmlarea files var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; } if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } // --></script> <script language="JavaScript"> function checkvalue() { if(parseInt(document.all.txtPrice.value) >= parseInt(document.all.txtPriceNormal.value)) { alert('ราคาพิเศษจะต้องน้อยกว่ากว่าราคาปกติ'); document.all.txtPrice.focus(); return false; }else { return true; } } </script> <table width="100%" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="18%"> </td> <td width="82%"> </td> </tr> <tr> <td valign="top">รหัสสินค้า <font color="#FF0000">** </font></td> <td><input name="txtProductCode" type="text" class="txtbox" id="txtProductCode" value="<?=$result["ProductCode"];?>" maxlength="20" readonly> </td> </tr> <tr> <td valign="top">สินค้าโปรโมชั่น <font color="#FF0000">** </font></td> <td><input name="rdoPromotion" type="radio" value="Yes" <? if($result["Promotion"]=="Yes"){?>checked<?}?>> ใช่ <input type="radio" name="rdoPromotion" value="No" <? if($result["Promotion"]=="No"){?>checked<?}?>> ไม่ใช่</td> </tr> <tr> <td valign="top">สินค้าใหม่ <font color="#FF0000">** </font></td> <td><input name="rdoNew" type="radio" value="Yes" <? if($result["New"]=="Yes"){?>checked<?}?>> ใช่ <input type="radio" name="rdoNew" value="No" <? if($result["New"]=="No"){?>checked<?}?>> ไม่ใช่</td> </tr> <tr> <td valign="top">ชื่อสินค้า <font color="#FF0000">** </font></td> <td><input name="txtProductName" type="text" class="txtbox" id="txtProductName" style="width:550" value="<?=$result["ProductName"];?>" maxlength="100"></td> </tr> <tr> <td valign="top">ราคาปกติ <font color="#FF0000">** </font></td> <td><input name="txtPriceNormal" type="text" class="txtbox" id="txtPriceNormal" value="<?=$result["PriceNormal"];?>" size="10" maxlength="20"> บาท </td> </tr> <tr> <td valign="top">ราคาพิเศษ <font color="#FF0000">** </font></td> <td><input name="txtPrice" type="text" class="txtbox" id="txtPrice" value="<?=$result["Price"];?>" size="10" maxlength="20"> บาท </td> </tr> <tr> <td valign="top">ค่าจัดส่ง</td> <td><input name="txtPriceSend" type="text" class="txtbox" id="txtPriceSend" value="<?=$result["PriceSend"];?>" size="10" maxlength="20"> บาท </td> </tr> <tr> <td valign="top">สำนวนสต็อก <font color="#FF0000">** </font></td> <td><input name="txtStock" type="text" class="txtbox" id="txtStock" value="<?=$result["Stock"];?>" size="10" maxlength="20"></td> </tr> <tr> <td valign="top">รูปภาพ <font color="#FF0000">** </font></td> <td><img src="../picture/<?=$result["Picture"];?>" /></td> </tr> <tr> <td valign="top"> </td> <td><input name="file" type="file" class="txtbox" id="file"></td> </tr> <tr> <td valign="top">รายละเอียด <font color="#FF0000">** </font></td> <td><textarea name="txtDescription" cols="40" rows="10" class="txtbox" id="txtDescription" style="width:550; height:450"><?=$result["Description"];?></textarea> <script language="javascript1.2"> editor_generate('txtDescription'); </script> </td> </tr> <tr> <td></td> <td><input name="Submit" type="submit" class="button" value="บันทึก"> <input name="Cancel" type="button" class="button" id="Cancel" value="ยกเลิก" onClick="window.location='product.php?CatID=<?=$result["CatID"];?>';"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table></td> </tr> </tbody> </table> <table cellspacing=0 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10"> <tbody> <tr bgcolor=#e5e5e5> <td width="100%" bgcolor="#FFFFFF"> <div align="center"></div> <table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10"> <tbody> <tr bgcolor=#e5e5e5> <td width="35%" bgcolor="#FFFFFF"> <div align="left"></div></td> <td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left"> </div></td> <td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="product.php?CatID=<?=$result["CatID"];?>">กลับไป</a></div></td> </tr> </tbody> </table></td> </tr> </tbody> </table> </form>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง