<table width="517" border="" bordercolor="#333333"> <tr> <td width="101"bgcolor="#333333"><font color="#FFFFFF">Picture</font></td> <td width="101"bgcolor="#333333"><font color="#FFFFFF">ProductID</font></td> <td width="82"bgcolor="#333333"><font color="#FFFFFF">ProductName</font></td> <td width="79"bgcolor="#333333"><font color="#FFFFFF">Price</font></td> <td width="43"bgcolor="#333333"><font color="#FFFFFF">Discount</font></td> <td width="36"bgcolor="#333333"><font color="#FFFFFF">Amount</font></td> <td width="29"bgcolor="#333333"><font color="#FFFFFF">Cart</font></td> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><img src="img/<?=$objResult["Picture"];?>" /></td> <td><?=$objResult["ProductID"];?></td> <td><?=$objResult["ProductName"];?></td> <td><?=$objResult["Price"];?></td> <td><?=$objResult["Discount"];?></td> <td><input name="qty" type="text" id="qty" size="2" value=1 /></td> <td><a href="order.php?ProductID=<?=$objResult["ProductID"];?>">Order</a></td> </tr> <? } ?> </table>
<? ob_start(); session_start(); if(!isset($_SESSION["intLine"])) { $_SESSION["intLine"] = 0; $_SESSION["strProductID"][0] = $_GET["ProductID"]; $_SESSION["strQty"][0] = 1; header("location:show.php"); } else { $key = array_search($_GET["ProductID"], $_SESSION["strProductID"]); if((string)$key != "") { $qtyy =$_POST["qty"][0]; $_SESSION["strQty"][$key] = $_SESSION["strQty"][$key] + 1; } else { $_SESSION["intLine"] = $_SESSION["intLine"] + 1; $intNewLine = $_SESSION["intLine"]; $_SESSION["strProductID"][$intNewLine] = $_GET["ProductID"]; $_SESSION["strQty"][$intNewLine] = 1; } header("location:show.php"); } ?>
<? $Total = 0; $SumTotal = 0; for($i=0;$i<=(int)$_SESSION["intLine"];$i++) { // echo $_SESSION["qty"][$i]; if($_SESSION["strProductID"][$i] != "") { $strSQL = "SELECT * FROM product WHERE ProductID = '".$_SESSION["strProductID"][$i]."' "; $objQuery = mysql_query($strSQL) or die(mysql_error()); $objResult = mysql_fetch_array($objQuery); $Total = $_SESSION["strQty"][$i] * $objResult["Price"]*((100-$objResult["Discount"])/100); $SumTotal = $SumTotal + $Total; ?> <tr> <td><?=$_SESSION["strProductID"][$i];?></td> <td><?=$objResult["ProductName"];?></td> <td><?=$objResult["Price"];?></td> <td><?=$objResult["Discount"];?></td> <td><?=$_SESSION["strQty"][$i];?></td> <td><?=number_format($Total,2);?></td> <td><a href="delete.php?Line=<?=$i;?>">x</a></td> </tr> <? } } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง