Re: Undetermined number of radios to be 'remembered'
| From: | Julio Nobrega Trabalhando | Date: | Thu, 11 Oct 2001 19:45:35 +0000 |
| Subject: | Re: Undetermined number of radios to be 'remembered' | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70849@lists.php.net to get a copy of this message | ||
Thanks Chris and Jason. Here's how I finished:
<?php
$infotec_qtd++;
// Increase it by one to work how I expected on the while loop.
for( $i = 1; $i < $infotec_qtd; $i++ ) {
$varName = "peso_$i";
$keepTrackOfArray[] = $varName;
}
// Thanks to Chris.
foreach ($keepTrackOfArray as $value) {
echo $value . ' - ';
echo $$value . "<br/>";
}
?>
It printed exactly what I wanted to (in the format 'radiobutton_name -
value'), ie:
peso_1 - 0
peso_2 - 1
peso_3 - 1
peso_X - (selected radio button value)
And so on.
Thanks again!
--
Julio Nobrega
A hora está chegando:
http://toca.sourceforge.net
"Chris Boget" <Chris.Boget@wild.net> wrote in message
news:4040BBE81A9AD411BD27009027887A7C042F3F@tiger.wild.net...
> > But how can I create an array from variables that I don't
> > know what the names are going to be, only that they will be
> > named 'peso_X', with 'X' being a random number, a random
> > number of times? (At least it will not repeat).
>
> for( $i = 0; $i < 10; $i++ ) {
> $varName = "peso_$i";
>
> $keepTrackOfArray[] = $varName;
>
> }
>
> Chris
>