Forum Moderators: coopster

Message Too Old, No Replies

how do you pass data between pages without putting it in the url?

         

ocelot

1:08 am on Oct 22, 2004 (gmt 0)

10+ Year Member



is there a way in php to do this?

is there more than one way?

Menekali

1:24 am on Oct 22, 2004 (gmt 0)

10+ Year Member



use the POST function in your form.

ocelot

3:30 am on Oct 22, 2004 (gmt 0)

10+ Year Member



sorry I meant *without forms*

isn't there a php function or something to pass data between scripts?

mincklerstraat

8:19 am on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use sessions (the 'automatic' way if you have lots of info) or cookies (sessions preferable - they let you load up lotsa info just using one cookie).

jezzer300

9:59 pm on Oct 23, 2004 (gmt 0)

10+ Year Member



If you're a real beginner this should help. If cookies are enabled you'll not see anything after the URL, otherwise it'll have the session ID.

include this line at the top of all your scripts...

session_start();

you can set session variables like this...

$_SESSION['imageSize'] = 1;

and check whether it's set like this...

if (!isset($_SESSION['imageSize'])) {...code...}

This will work differently depending on how your sessions are configured in php.ini.

If sessions don't work with cookies disabled, you probably need to add this line to php.ini...

session.use_trans_sid=1

Call function "phpinfo()" from your script and you'll find the php session configuration.

If your user is using cookies you can extend their session for as long as you want like this... (this sets the session to expire in a year, call before session_start!)...

session_set_cookie_params (60*60*24*365*1);

Have fun.