Re: Null Variables after session_register() ( Radio Inputs Problem )

From: Date: Tue, 23 Mar 2004 21:28:27 +0000
Subject: Re: Null Variables after session_register() ( Radio Inputs Problem )
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181312@lists.php.net to get a copy of this message
Gohaku wrote:
Apologies if this has been asked before, I'm experiencing problems with Session Variables and Radio Inputs values. For some reason, after I use session_register("number") where $number has 3 possible values { 1,2,3 }, $number IS NULL. If I don't use session_register("number"), $number IS NOT NULL. I did not see any difference with checkbox inputs either. Any help would be greatly appreciated. Thank you. -gohaku <!--Form.html--> <form action="session.php" method="POST"> Name: <input type="text" name="name" size="30"><br> <input type="radio" name="number" value="1" CHECKED>1<br> <input type="radio" name="number" value="2">2<br> <input type="radio" name="number" value="3">3<br> <input type="submit" name="submit" value="Session Test"> </form> <? /***********Session.php**********/ $varcount = 0;
if($name)    {    $varcount++;    }
if($number){    $varcount++;    }
session_start(); session_register("name"); session_register("number"); ?> <html> <head><title><?=$number?></title></head>
You may want to look into using the superglobal $_SESSION instead of using session_register and global variables. It's far more secure and generally works without so many problems. -- paperCrane <Justin Patrin>

« previous php.general (#181312) next »