[solved]$_POST vs $_SESSION

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jslavin
Forum Newbie
Posts: 8
Joined: Fri Jun 17, 2005 3:52 pm

[solved]$_POST vs $_SESSION

Post by jslavin »

Hello,

Was wondering if there is a big difference between $_POST and $_SESSION besides that $_SESSION variables can only be used when a session is initialized.

I'm running into some problems because I was using pure $_SESSION; however, some of my classes modify the globals, and since classes have to be included before a $_SESSION, i have a problem.

Will I loose any advantages from switching to $_POST for most of my globals?

Thanks in advance,
Jeff
jmslavin@hotmail.com
Last edited by jslavin on Mon Jun 20, 2005 3:15 am, edited 1 time in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

http://ca3.php.net/reserved.variables should answer your question
User avatar
senthilnayagam
Forum Newbie
Posts: 17
Joined: Wed Jun 08, 2005 5:36 am
Location: Bangalore

Post by senthilnayagam »

maybe you should improve your coding and class

dont compare $_POST and $_SESSION, they are totaly different things and has its own purpose

if you suspect your session data get overwritten, go for locked session handlers

you can find one on http://www.phpclasses.org/browse/package/1840.html


regards
senthil
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

To summarize...

$_SESSION - Used to store information while a user is online, no matter where they are on the site.
$_POST - Used to pass information between individual files
jslavin
Forum Newbie
Posts: 8
Joined: Fri Jun 17, 2005 3:52 pm

[solved] $_POST vs $_SESSION

Post by jslavin »

thanks guys for all your help!
Post Reply