Re: problems with variables

From: Date: Tue, 04 Feb 2003 02:58:40 +0000
Subject: Re: problems with variables
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-25396@lists.php.net to get a copy of this message
OK, now I get it: $input = '<input type="hidden" name="q' . $i . '" value="' . ${$q . $i} . '">" . "\n"; print($input); This one isn't well known so don't forget it!! ;) Larry Marcel <m.h.a.reuvekamp@student.utwente.nl> wrote: > Sorry, I see that I've got the a's and q's mixed up. > I'll try to clarify it some more by giving an example with 2 variables. > $q1 = "first_var"; > $q2 = "second_var"; > for($i=1;$i<=2;$i++) > { > echo "<input type=\"hidden\" name=\"q$i\" > value=\"$q$i\">\n"; > } > The output should now be: > <input type="hidden" name="q1" value="first_var"> > <input type="hidden" name="q2" value=\"second_var"> > Hope you can help me, > Marcel

« previous php.db (#25396) next »