oracle259 Posted November 2, 2006 Share Posted November 2, 2006 How can i pass a variable from one page to another using text links without it appearing in the url or using a cookie Quote Link to comment Share on other sites More sharing options...
hostfreak Posted November 2, 2006 Share Posted November 2, 2006 Hmm, have you considered using a session? Quote Link to comment Share on other sites More sharing options...
lowe_22 Posted November 2, 2006 Share Posted November 2, 2006 Use sessions.You must have [code]session_start();[/code] at the top of the page you want to define or call sessions or you will get some nice errors...Then, simply register assign your session to a variable. Eg :[code]<?session_start();$name="Olly";session_register('name');$_SESSION['name'] = $name;?>[/code]Then you can use the value assigned to $name on any page by calling [code]$_SESSION('name');[/code] eg,[code]<?session_start();echo "Name:" . $_SESSION['name'];// Prints:// Name: Olly?>[/code] Quote Link to comment Share on other sites More sharing options...
JustinK101 Posted November 2, 2006 Share Posted November 2, 2006 lowe_22:I just recently discovered, dont recommend register_session() as this function wont be supported on systems without register_globals, and in version 6, wont be supported at all.Instead recommend:<?session_start();$name="Olly";$_SESSION['name'] = $name;?> Quote Link to comment Share on other sites More sharing options...
lowe_22 Posted November 3, 2006 Share Posted November 3, 2006 Oh, ok. Thanks, I didn't realise that.I thought you had to use the register_session() function to initiate the variable... Im guessing you can just define it straight away then!cheers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.