function getjson_cartupdate($qty){ if(count($_SESSION["cartNumber"])>0){ $TotalAmount=0;$TotalPrice=0; foreach($_SESSION["cartNumber"] as $RowCount){ $_SESSION[$RowCount][1] = $qty; //$_SESSION[$RowCount][1] = 2; $num = $_SESSION[$RowCount][1]; $TotalAmount+=$_SESSION[$RowCount][1];#คำนวณหาจำนวนสินค้าทั้งหมด $TotalPrice+=($_SESSION[$RowCount][2]*$_SESSION[$RowCount][1]);#คำนวณหาราคาสินค้าทั้งหมด } echo '{"num":"'.count($_SESSION["cartNumber"]).'","quantity":"'.$TotalAmount.'","price":"'.$TotalPrice.',"n":"'.$num.'""}'; }else{ echo '{"num":"0","quantity":"0","price":"0"}'; } }
<? 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 != "") { $_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"); } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง