|
Posted by nescio on 03/12/06 18:12
hello,
i am making an application that works a bit like a shopping cart.
people can click on items.
then, the items are stored in an session variable .
echo "<a href='" . $_SERVER['PHP_SELF'] . "?article=" . $articleNumber .
"'>description of article</a>";
then when the page reloades, something like: (i did not copy this code so
there may be some typo's in it,
but that is not important)
if(!isset($_SESSION['articles'])){
$_SESSION['article'] = array();
$_SESSION['article'][] = $_GET['article'];
}else if(isset($_SESSION['articles']) &&
isset($_SESSION['articles'][$_GET['article'])){
$_SESSION['articles'][$_GET['article'] =+ 1 ;
}else if{isset($_SESSION['articles']) && !
isset($_SESSION['articles'][$_GET['article'])){
$_SESSION['articles'][$_GET['article'];
}
then i can loop through the array and put the '$articleNumber' in a query
and get the information from a database.
it all works fine for one thing:
when peole reload the page it adds one up because it executes the $_GET
variable.
so, when people got one time item A, and they reload the page, they got two
times item A.
but i want them stil to have one time item A after reloading the page.
how can i do this?
thanks
Navigation:
[Reply to this message]
|