session_register trouble ?

From: Date: Thu, 12 Sep 2002 11:28:25 +0000
Subject: session_register trouble ?
Groups: php.general 
Request: Send a blank email to php-general+get-116130@lists.php.net to get a copy of this message
Hello, I use this code : $myarray= array(); session_register ("myarray"); $i=0; while ($row = mysql_fetch_object($result)) { $myarray[$i][0] = $row->ID; $myarray[$i][1] = $row->NOM; $myarray[$i][2] = $row->PRENOM; $i = $i + 1; } for($i=0; $i<sizeof($myarray);$i++){ ?> <a href="index.php?argumenthere=test&id=<?php echo($myarray[$i][0]); ? >"><?php echo($myarray[$i][2]); ?></a> <?php } mysql_free_result($result); mysql_close($link); ?> That's work. But when I add an <a href="...."> to call an another page (at the end of this) and in this another page I use axactly the same for loop than in the previous code <?php for($i=0; $i<sizeof($myarray);$i++){ ?> <a href="index.php?argumenthere=test&id=<?php echo($myarray[$i][0]); ? >"><?php echo($myarray[$i][2]); ?></a> <?php } ?> I receive the error : Notice: Undefined variable: myarray in .... I solved the problem, I did that : - register_globals = On - use session_start(); on the top of the second page too Is it normal ? Bye

« previous php.general (#116130) next »