Re: Variable variable

From: Date: Wed, 18 Apr 2001 07:20:38 +0000
Subject: Re: Variable variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49139@lists.php.net to get a copy of this message
Jacky schrieb: > <!-- I got the value $id from a table and looping them and assign them to the check box > name--> > <input type="checkbox" name ="$id" value="on"> > > and when I submit the form to page foo.php4, at that page, I use Variable variable to call the > value of the check box to see if it checked like this > > $quey = "select id from table"; > $result = ...... ( assumeing it is done and i got value for $id for all records from table) > > if ($$id =="on"){ > echo "on"; > }else{ > echo "off"; > } What's the value of $id in the second snippet? Generally speaking using $GLOBALS[$id] gives you more readable code but variable variables. Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de

« previous php.general (#49139) next »