<?php session_start(); $strProductID = $_POST["tProductID"]; $strQty = $_POST["tQty"]; include("dbconnect.php"); if($strProductID != "" and $strQty != "") { $strSQL = "INSERT INTO cart "; $strSQL .="(SID,ProductID,Qty) "; $strSQL .="VALUES "; $strSQL .="('".session_id()."','".$strProductID."','".$strQty."') "; $objQuery = mysql_query($strSQL); } ?> <style type="text/css"> <!-- .style3 { color: #339900; font-weight: bold; } .style4 { color: #33CC33; font-weight: bold; } .style5 {color: #33CC33} .style6 { color: #FF0000; font-weight: bold; } .style7 {color: #0000CC} .style9 {color: #0000CC; font-weight: bold; } --> </style> <center> <h1 class="style1">รายการซื้อสินค้า</h1> <table width="492" height="115" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="93"><div align="center" class="style3">รหัสสินค้า</div></td> <td width="115" height="26"><div align="center" class="style3">ชื่อสินค้า</div></td> <td width="57"><div align="center" class="style3">ราคา</div></td> <td width="59"><div align="center" class="style3">จำนวน</div></td> <td width="84"><div align="center" class="style3">รวม(บาท)</div></td> </tr> <? $intSumTotal = 0; $intRows = 0; $strSQL = "SELECT * FROM cart WHERE SID = '".session_id()."' "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); while($objResult = mysql_fetch_array($objQuery)) { $intRows ++; //*** Product ***// $strSQL = "SELECT * FROM product WHERE ProductID = '".$objResult["ProductID"]."' "; $objQueryPro = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $objResultPro = mysql_fetch_array($objQueryPro); $intTotal = $objResult["Qty"] * $objResultPro["Price"]; $intSumTotal = $intSumTotal + $intTotal; ?> <tr> <td><div align="center"><?=$intRows;?></div></td> <td><?=$objResultPro["ProductName"];?></td> <td><div align="right"><?=number_format($objResultPro["Price"],2);?></div></td> <td><div align="center"><?=$objResult["Qty"];?></div></td> <td><div align="right"><?=number_format($intTotal,2);?></div></td> </tr> <? } ?> <tr> <td colspan="4"><div align="right" class="style3">ราคารวม </div></td> <td> <div align="right"><?=number_format($intSumTotal,2);?></div></td> </tr> </table> <? if($intSumTotal > 0) { ?> <br><input name="btnCheckOut" type="submit" id="btnCheckOut" value="Check Out" onClick="JavaScript:CheckOut();"> <? } ?> </center> ?>
<head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> //ลองเพิ่มบรรทัดนี้ </head> <?php session_start(); $strProductID = $_POST["tProductID"]; $strQty = $_POST["tQty"]; include("dbconnect.php"); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง