Log in

View Full Version : how to post something to a session



cowguru2000
01-24-2007, 08:16 PM
Hi,

How would I, instead of submitting something to the $_POST array, make it go into the $_SESSION array?

cowguru2000
01-24-2007, 08:37 PM
Yeah, also what should I use if I want to include stuff in my PHP files? .inc or what?

Twey
01-24-2007, 09:52 PM
How would I, instead of submitting something to the $_POST array, make it go into the $_SESSION array?You wouldn't. POST it to a page, and then from there put it into a session.
Yeah, also what should I use if I want to include stuff in my PHP files? .inc or what?The file extension doesn't matter. It's common to use something like .php or .inc.php (or to cause PHP to parse .inc files) to avoid people viewing the source of the include, which may contain sensitive information. However, it's really not important.

cowguru2000
01-25-2007, 07:51 PM
Ok, how would I put a variable into the session?

cowguru2000
01-25-2007, 07:51 PM
By the way, thank you sooooo much!

Twey
01-25-2007, 08:29 PM
Read http://www.php.net/session for more information on handling sessions.

djr33
01-25-2007, 10:52 PM
$_SESSION['varname'] = $_POST['varname'];

Or, if you really wanted....
$_SESSION = $_POST;

But I think that would screw things up, including confusing the session id.
I think there's a merge Array function available. Check php.net for it.

And check the link Twey gave... should help.

cowguru2000
01-26-2007, 09:24 PM
Thank you so much everybody for your time and help!!!!!!!!!!!! :) :D