News:

Wondering if this will always be free?  See why free is better.

Main Menu

How to use $_Session variables

Started by Ride, August 18, 2005, 03:04:45 PM

Previous topic - Next topic

Ride

I have a text box in the registration section where a new user can enter in a referer name.  I've got this type of url to work to automatically populate the field with the name in the string.... http://www.ridesocal.com/forum/index.php?action=register&ref=SomeMember

That is using $_REQUEST['ref'] in the registration.template

I'd like to use $_Session (that's what it is right?) to have my "ref" variable stay with the guest as they browse the site and when it comes time to register populate the referer text field.  I've tried a few things and haven't gotten it to work.  I'm guessing there is any easy answer to this.  Help!  :)

Chris Cromer

Actually it's $_SESSION. Case is important.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Ride

I just got lazy typing.  I've been using all caps.  So any insight on how to do this?

[Unknown]

You'd do something like:

if (isset($_REQUEST['ref']))
   $_SESSION['ref'] = $_REQUEST['ref'];

And then use $_SESSION['ref'] when appropriate.

-[Unknown]

Ride

Quote from: [Unknown] on August 18, 2005, 08:41:18 PM
You'd do something like:

if (isset($_REQUEST['ref']))
   $_SESSION['ref'] = $_REQUEST['ref'];

And then use $_SESSION['ref'] when appropriate.

-[Unknown]

Where would I put that first part?  In the registration.template.php file?

[Unknown]

I suppose that would probably work.  If you want the ?ref=... to work from anywhere, put it in the init sub template (template_init) in index.template.php.

-[Unknown]

Ride

Quote from: [Unknown] on August 19, 2005, 12:27:05 AM
I suppose that would probably work.  If you want the ?ref=... to work from anywhere, put it in the init sub template (template_init) in index.template.php.

-[Unknown]

I'll try that tomorrow when I wake up.  Thank You!


Advertisement: