|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
persistant cart tut, with no SQL!
Hi all, I am looking for a way to display the contents of my shopping cart without using a database for the time being. I have it down so I need to spit out everything in the $_SESSION array that has a value, but am lost on the way to start. Basically whenever someone clicks "add to cart", I then set the registered variable with a value. Then comes checkout time and everything has to be displayed. I have tried this but won't work...
for($i = 0; $i <= sizeof($_SESSION); $i++) { if(isset($_SESSION['$i'])){ echo $_SESSION['$i']; } } Any help would be greatly appreciated. I know of all the "free" scripts out there, but haven't found one that I understand completely yet, and I want to learn this for myself ![]() |
|
#2
|
|||
|
|||
|
You can try out with a foreach structure :
foreach($_SESSIONS as $key => $value) { echo $value; } But you surely want to add up some validation on what is displayed, so maybe someting like : foreach($_SESSIONS as $key => $value) { if ($key == "whatever") echo $value; } hope it will help ciao! |
|
#3
|
|||
|
|||
|
Thanks for the response. I'll give it a shot
![]() |
|
#4
|
|||
|
|||
|
were you able to figure out how to do this? I would be interested in seeing the results if so.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > persistant cart tut, with no SQL! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|