It looks like your code could use "variable variables" to help you out.
::::::::::: OLD CODE ::::::::::::::::
> > for ($GameIdx = 1; $GameIdx <= 17; $GameIdx++) {
> > /* instead "hardcoding each radio button name - just do it
> programmatically
> > by concatenating / creating the name */
> > $frmGame = "Game" + $GameIdx;
> > if ($frmGame) {
::::::: END OF OLD CODE :::::::::::::
** this check will always be true - because you just set $frmGame equal to a
value... ***
What you want to do at this point is use variable variables (where the
variable name is actually
a variable itself.
::::::::: NEW CODE :::::::::::
> > $var_frmGame = "Game" + $GameIdx;
> > $frmGame = $$var_frmGame; // The "$$" is used for variable variables
> > if ($frmGame) {
:::::: END OF NEW CODE :::::::
** the above snippett is was I wrote to show the results of the dynamic
(looped-through) variable $Game1, $Game2, ...
I use this method when the number of form elements is variable. Instead of
hardcoding the number "17" you might make a variable in the incoming form
with the count of form elements (simply increment a variable with each
printing of the form variable... then at the end of the form make <input
type="hidden" name="elementcount" value="$count">)
Then you can make the above for-statement look like this:
> > for ($GameIdx = 1; $GameIdx <= $elementcount; $GameIdx++) {
Does any of this make sense or help in any way?
-Mark
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php