<?php require_once('../Connections/localhost.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_localhost, $localhost); $query_RecCategory = "SELECT * FROM category ORDER BY category_id ASC"; $RecCategory = mysql_query($query_RecCategory, $localhost) or die(mysql_error()); $row_RecCategory = mysql_fetch_assoc($RecCategory); $totalRows_RecCategory = mysql_num_rows($RecCategory); session_start(); $sessionID= session_id(); $removeProductID = $_POST['pro_id']; $_SESSION['adminname']; if(!isset($_SESSION['adminname'])) { header("Refresh: 3; url=../index.php"); echo("คุณไม่ได้รับสิทธิ์ใช้งานในส่วนนี้ค่ะ"); exit; } ?> <html> <head> <meta charset="windows-874"> <title>edit-product</title> <style type="text/css"> .menu { font-family: "th Sarabun New"; font-size: 24px; color: #000; } .login { font-family: "th Sarabun New"; font-size: 24px; color: #000; } a:link { color: #333; text-decoration: none; } a:visited { color: #333; text-decoration: none; } a:hover { color: #333; text-decoration: none; } a:active { color: #FF3300; text-decoration: none; } .font { font-family: "th Sarabun New"; font-size: 24px; color: #FFF; } </style> </head> <body> <table width="1024" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2"><img src="../img/NEWhome.jpg" width="1024" height="150"></td> </tr> <tr> <td colspan="2" bgcolor="#FEC81E"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="menu"> <td align="center" bgcolor="#FEC81E"><a href="product_add.php">เพิ่มสินค้า</a></td> <td align="center" bgcolor="#FFFAB6">แก้ไขสินค้า</td> <td align="center" bgcolor="#FEC81E"><a href="product_del.php">ลบสินค้า</a></td> </tr> </table></td> </tr> <tr> <td width="200" valign="top" bgcolor="#EFEFEF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td onmouseover="this.bgColor='#FFFFFF'" onmouseout="this.bgColor='#EEEEEE'"><span class="login"><a href="product_main.php"> จัดการเกี่ยวกับสินค้า</a></span></td> </tr> <tr> <td onmouseover="this.bgColor='#FFFFFF'" onmouseout="this.bgColor='#EEEEEE'"><span class="login"><a href="worker_main.php"> จัดการเกี่ยวกับพนักงาน</a></span></td> </tr> <tr> <td onmouseover="this.bgColor='#FFFFFF'" onmouseout="this.bgColor='#EEEEEE'"><a href="order_list.php" class="login"> จัดการเกี่ยวกับลูกค้า</a></td> </tr> </table></td> <td width="824" bgcolor="#FFFFE1"><p> </p> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" class="login"><h1 class="login">รายละเอียดสินค้า</h1> <?php include("../dbconn.inc.php"); if ($ProductID>0){ $sql = "UPDATE product SET pro_name = '$Pname', price = '$Pprice', pro_quant = '$Pquant', category_id = '$Pcategory' WHERE product.pro_id ='$ProductID' ;"; mysql_query($sql); } $sql = "SELECT * FROM product"; $result = mysql_query($sql); $totalPrice=0; echo"<table align='center' width='90%' border='0' cellspacing='1' cellpadding='0' bordercolor='#000000' bgcolor='#000000' > <tr bgcolor='#ddddff' class='login'> <td align='center'> <b>รหัส</b></td> <td width='180' align='center'> <b>ชื่อ</b></td> <td width='180' align='center'><b>ราคา</b></td> <td width='180' align='center'><b>จำนวน</b> <td align='center'><b>แก้ไข</b> </td> </tr>"; while($row=mysql_fetch_array($result)){ $ProductID=$row["pro_id"]; $productName = $row["pro_name"]; $productPrice = $row["price"]; $productQuant = $row["pro_quant"]; echo "<tr class='login' bgcolor='#FFFFFF' align='center'><form id='form1' name='form1' method='post' action='product_edit.php'>"; echo "<td>$ProductID<input name='ProductID' type='hidden' value='$ProductID'></td><td><input name='Pname' type='text' value='$productName'></td>"; echo "<td><input name='Pprice' type='text' value='$productPrice'></td><td><input name='Pquant' type='text' value='$productQuant '></td>"; echo "<td valign='middle'><input type='submit' name='Delete' id='Edit' value=' แก้ไข ' onclick=" ?>"return confirm('คุณแน่ใจว่าต้องการแก้ไขข้อมูลนี้หรือไม่ ? ')" /> <? "/>"; echo "</td></form></tr>"; } echo "</table>"; ?></td> </tr> </table> <p> </p> <p> </p></td> </tr> </table> <p> </p> <p> </p> </body> </html> <?php mysql_free_result($RecCategory); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง