You are here: $_SESSION - $_GET - reloading page problem « All PHP « IT news, forums, messages
$_SESSION - $_GET - reloading page problem

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация