You can do:

for ($i=1; $i < 12; $i++) {
  $n = "state_$i";
  echo $$n;

That should do what you want (if I understood what you want correctly ;)


"Phillip S. Baker" <[EMAIL PROTECTED]> wrote in message
> I am not sure I can articulate this well.
> But I will try.
> I want to combine either two variables or a variable and string to bring
> the name of a previous variable name to display the data from the first.
> So in the first part I will have a listing that will look like
> <type=radio name=state_1 value=No>
> <type=radio name=state_1 value=Yes>
> <type=radio name=state_1 value=Maybe>
> <type=radio name=state_2 value=No>
> <type=radio name=state_2 value=Yes>
> <type=radio name=state_2 value=Maybe>
> // Submit etc....
> Then later I will call a for loop to try and do something like
> for ($i=1; $i < 12; $i++) {
> echo state_$i; // This would print out either Yes No or Maybe.
> }
> Is there a way I can do this.
> I thought I heard something about how I can but I do not remember.
> Phillip

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to