<?
ob_start();
session_start();
if($_SESSION['MNo'] <> "") { //check login
if(!isset($_SESSION["intLine"]))
{
$_SESSION["intLine"] = 0;
$_SESSION["strProductID"][0] = $_GET["PNo"];
$_SESSION["strQty"][0] = 1;
header("location:show.php");
}
else
{
$key = array_search($_GET["PNo"], $_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["PNo"];
$_SESSION["strQty"][$intNewLine] = 1;
}
header("location:show.php");
}
}else{
echo("<script> alert('Please Login !');</script>");
echo "<meta http-equiv='refresh' content='0;url= index.php'>";
}
?>
รบกวนช่วยให้หาความหมาย โค๊ต PHP นี้หน่อยครับ เรื่องการทำตะกร้าสินค้า อย่างละเอียด พอดีต้องอธิบายส่งอาจารย์
ob_start();
session_start();
if($_SESSION['MNo'] <> "") { //check login
if(!isset($_SESSION["intLine"]))
{
$_SESSION["intLine"] = 0;
$_SESSION["strProductID"][0] = $_GET["PNo"];
$_SESSION["strQty"][0] = 1;
header("location:show.php");
}
else
{
$key = array_search($_GET["PNo"], $_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["PNo"];
$_SESSION["strQty"][$intNewLine] = 1;
}
header("location:show.php");
}
}else{
echo("<script> alert('Please Login !');</script>");
echo "<meta http-equiv='refresh' content='0;url= index.php'>";
}
?>