note 21294 added to ref.session

From: Date: Tue, 07 May 2002 07:27:45 +0000
Subject: note 21294 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-30286@lists.php.net to get a copy of this message
BEGINNERS: [like me :)] To use sessions, follow these easy instructions that I worked up for my friend after I finally got sessions working. On the page that starts the session (the page you are passing the variable(s) from, at the very, very top (ABOVE ANY HTML TAGS) type: <?php session_start(); ....rest of code follows... Then at the point where you would like the variable to be sent (it will be sent as it is, at that point! so if you modify it later, the effects WILL NOT be sent), add this code (in php): session_register('variable_name'); You can use this line of code for as many variables as you want, replacing variable_name with its actual name, but leaving the quotes. Now, on the recieving end. Create some kind of link to the .php file that recieves these variables. When the user clicks on the link, the info will be sent. At the very, very top of the recieving file (once again, ABOVE ANY HTML), add: <?php session_start(); session_register('variable_name'); ...rest of code... This time, register the variables at the very top. Repeat the register code as many times as necessary. Now, the info will be loaded into those variables, and they will be ready to use! Good luck! - BadAssFrey -- http://www.php.net/manual/en/ref.session.php http://master.php.net/manage/user-notes.php?action=edit+21294 http://master.php.net/manage/user-notes.php?action=delete+21294 http://master.php.net/manage/user-notes.php?action=reject+21294

« previous php.notes (#30286) next »