PDA

View Full Version : POST and SESSIONS


Len Whistler
10-27-2005, 09:48 PM
With _POST or _GET form data is passed onto the next page and displayed. With _SESSIONS form data is also passed onto the next page and displayed.

But with _SESSIONS you can retrieve the data onto a 3rd page or anytime the user is still on your site, and the _POST or _GET data is not stored in memory and cannot be retrieved later on during the visit.

Is that right? Thanks.

cdc08x
10-27-2005, 10:17 PM
If you want to mantain get variables, the only way to keep them is to append to the URL their values encoded (something like

$_SERVER['PHP_SELF'].'?name=value'

) but it's not a good way of programming.

Sessions are definitely the best choice you can make, because their values are registered and remain there. They're like cookies in a certain way, but server-side (and overall they aren't impossible to use ever, while cookies can be set off by clients!).

Just remember that session values can't be instanciated if some html code has been printed before!!