missing session...

They have: 164 posts

Joined: Nov 2001

hi, i pass qty from 1.php to 2.php. there will be a few qty depends on how many items user add to cart. i got this session stored in my 2.php...

<?php
if (count($_SESSION['qty']) == 0)
{
    for (
$i=0;$i<count($_POST['qty']) ;$i++)
    {
       
$_SESSION['qty'][] = $_POST['qty'][$i];   
    }
}
?>

2.php is a page to display the user address and etc, then it will continue to 3.php. i tried to retreive the qty in 3.php but i only can get the first qty.

this is how i store in 3.php.

<?php
for ($i=0;$i<count($_SESSION['pid']) ;$i++)
{
   
$select_product = mysql_query(\"select sku, our_price from sc_product where pid = '\".$_SESSION['pid'][$i].\"'\");
    while (
$tp = mysql_fetch_array($select_product))
    {
       
$sku = $tp['sku'];
       
$price = $tp['our_price'];

       
$order = mysql_query(\"insert into sc_order (oid, pid, uid, pay_method, sku, date, qty, price, status) values ('$oid', '\".$_SESSION['pid'][$i].\"', '$uid', '$pay', '$sku', '$date', '\".$_SESSION['qty'][$i].\"', '$price', '$status')\");
        }
}
?>

for eg, user add 3 items in the cart, i can only get the first qty out of 3. wat is wrong?

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Did you ever solve this problem:
http://webmaster-forums.net/showthread.php?s=&threadid=18980

It looks to me like the two problems are very similar. Perhaps you could use the same solution?

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.