Compound(?) $$variable question.
| From: | Cosenza, Mario | Date: | Wed, 02 Aug 2000 20:11:23 +0000 |
| Subject: | Compound(?) $$variable question. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9815@lists.php.net to get a copy of this message | ||
I 'php-generated' a form that has a variable number of text boxes (depending
on user input $usercount).
<input type=text name=tbox0>
<input type=text name=tbox1>
<input type=text name=tbox2>
etc...
When the form gets posted, I intended to loop through the $HTTP_POST_VARS to
get the values.
$HTTP_POST_VARS['tbox0']
$HTTP_POST_VARS['tbox1']
$HTTP_POST_VARS['tbox2']
etc...
I thought I could use a counter to loop through the data (like this...)
$prefix="tbox";
$i=0;
while ($i<$usercount){
echo $HTTP_POST_VARS[$$prefix$i]; // I really want [$tbox0], 1, 2, 3,
etc.
$i++;
}
Of course this isn't working.
Does anyone have any better suggestions? Is this possible?
Thanks,
mario