SESSION and POST/GET

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
User avatar
ybdl
Forum Newbie
Posts: 3
Joined: Fri Oct 25, 2002 12:45 am

SESSION and POST/GET

Post by ybdl »

Since PHP 4.2+ have the register_globals set to off, and I have an application that I am trying to build that needs to register the variables within the POST/GET'd variables...

for example, if I am trying to do the following:

Code: Select all

<form name=imrsys action=Post>
Name: <input type = text name=name value=<?echo $imrsys&#1111;'name']?>
MemberType: ..... etc)
</form>
Now I want to register the value in the $imrsys['name'} as a SESSION Variable, now... How do i do that? (Since there are more then one variable that I want to register to the session_register...

And How would I "recall" it in the subsequent pages of scripts?

would i (to register):
  • 1. - $session_register ('_POST')
    2. - $session_register ('imrsys')
    3. - $session_register ('imrsys[]')
    4. - $session_register ('_POST[imrsys]')
?
THank you for your help
User avatar
KillerCheeto
Forum Newbie
Posts: 1
Joined: Wed Jan 15, 2003 8:12 pm
Location: Raytown, Missouri

Post by KillerCheeto »

With PHP 4.1.x and up... the way to easily set session variables is to do:

session_start();
$_SESSION['variablename'] = $variablename;

Remember to call 'session_start();' for all pages that you want your session variable to show up at...
Post Reply