Re: Anyone Up?

From: Date: Fri, 01 Feb 2002 07:50:40 +0000
Subject: Re: Anyone Up?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-83078@lists.php.net to get a copy of this message
"Jtjohnston" <taylorjo@collegesherbrooke.qc.ca> wrote in message news:3C5A44F5.762CDFB4@collegesherbrooke.qc.ca... > Luke is that 6:47 pm tomorrow? :) You lost an entire day! > Enough Oz Jokes. Here is my predicament in Canada :-) > > $varname = "Check".$i; > > $varname = "Check1" but I want $varname = "Your Name1" to "Your > Name12". > > One more try? :) > > <INPUT TYPE="checkbox" NAME="Check1" VALUE="Your Name1"> > <INPUT TYPE="checkbox" NAME="Check2" VALUE="Your Name2"> > <INPUT TYPE="checkbox" NAME="Check3" VALUE="Your Name3"> > etc. > > for ($i = 1; $i <= $NMax; $i++) > { > #$varname = "$Check".$i; > $varname = "Check".$i > #echo $varname; > if ($varname) > echo "$varname = $i<br>"; > } In that case it is easy, I did not know that the ids were just 1 to 12, I thought they could be anything spat out by the database. How about something like this: for ($i = 1; $i <= $NMax; $i++) { $varname = "Check".$i if (isset($$varname) echo $$varname."<br>"; } Luke Welling. -- PHP and MySQL Web Development by Luke Welling and Laura Thomson http://www.amazon.com/exec/obidos/ASIN/0672317842

« previous php.general (#83078) next »