开发者

not able to retrieve old session variable values in php

Hi i am new to PHP.I am having "item.php" page and "cart.php" page. In item.php 3 checkboxes are available. if i cl开发者_运维技巧ick on one checkbox from item.php the value is sent to to cart.php page. however if i go back and select another checkbox the old value is not retained. Only the new value is getting printed. I am storing the retrieved checkbox value in a session variable in cart.php but still not able to retrieve the old values selected. Can anybody help me out? Thanks in advance


Do you have session_start( ) in your item.php page? If you're saving it via session in your cart.php page, you should have session_start( ) in your item.php page to get the session.

You can try to do this in your item.php page to check:

session_start( );
echo '<pre>';
print_r($_SESSION);
echo '</pre>';


You would have to start the session in item.php, too. This way you will be able to process the user's session data within both pages. In item.php you need to check if the user has selected any of your checkboxes (you can tell from their session value) and have this represented on the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜