session_register() problem

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
milleusi
Forum Commoner
Posts: 30
Joined: Mon Jun 13, 2005 3:18 am

session_register() problem

Post by milleusi »

a need a code with session_register("var_name"); , it creates a file, but the file is 0k. Where is the problem, Why I can't get the var_name. "var_name" is the name of an input_text into a previous POST form.

thx...
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

Code: Select all

session_register("var_name")
$_SESSION['var_name'] = $_POST['var_name'];
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

you don't need to user session_register(); just do

Code: Select all

$_SESSION['thing'] = $_POST['thing'];
or somthing similar
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

exactly what i thought, i dont bother with session_register but have worked with sessions alot
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

then on the next page remeber to use

Code: Select all

session_start();
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

session_register() is deprecated (I think that's right). All you need to do now with PHP4+ is to use session_start() on any page you wish to play with sessions on and then go ahead and treat the $_SESSION[] arrya like any other ;)
milleusi
Forum Commoner
Posts: 30
Joined: Mon Jun 13, 2005 3:18 am

Post by milleusi »

I have descovered that is OK, for me, only with session_register("var_name") , but needs register_globals=On in PHP.INI

manny thx for all
Post Reply