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:[EMAIL PROTECTED]]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]