RE: [PHP] combining variables

From: Date: Thu, 13 Sep 2001 01:01:22 +0000
Subject: RE: [PHP] combining variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67106@lists.php.net to get a copy of this message
i might be misunderstanding you, but anytime you need dynamic variable names, you'll want variable variables... $count = '123'; $name = "count$count"; # results in $name being 'count123' $$name = 'something'; # results in $count123 = 'something' jack -----Original Message----- From: Tyler Longren [mailto:tyler@captainjack.com] Sent: Wednesday, September 12, 2001 4:52 PM To: PHP-General Subject: [PHP] combining variables Hello, I have this: for ($i=1; $i<=$num_answers; $i++) { print "<b>Answer $i:</b> <input type=text name='answer$i'><br>"; } The user will enter the possible answers up there. When that form is submitted, I want to take the value from answer$i ($answer$i). I can't do this though. Here's what I've done: for ($i=1; $i<=$num_answers; $i++) { $insert_data_sql .= "'$answer$i', "; } Everytime I do a print "$answer$i", 1 is printed, or 2 is printed, or 3....and so on. So the actual value of that form field isn't printed. Is there any way to get around this? Thanks, Tyler Longren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#67106) next »