Re: Compound(?) $$variable question.

From: Date: Wed, 02 Aug 2000 20:27:19 +0000
Subject: Re: Compound(?) $$variable question.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9820@lists.php.net to get a copy of this message
> 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++; > } it seems like you want $HTTP_POST_VARS["tbox0"] rather than [$tbox0]. If that's true, then you'd probably want to just do $HTTP_POST_VARS[$prefix . $i] > <input type=text name=tbox0> > <input type=text name=tbox1> > <input type=text name=tbox2> Also, rather than having to loop through variables like you're doing, in your HTML form, you can just have something like: <input type=text name=tbox[0]> <input type=text name=tbox[1]> <input type=text name=tbox[2]> This way you can just say something like $tbox = $HTTP_POST_VARS["tbox"] and then use $tbox as an array. HTH Keith

« previous php.general (#9820) next »