Re: Dynamic Variable Creation from Forms
| From: | Josh G | Date: | Thu, 01 Feb 2001 00:31:27 +0000 |
| Subject: | Re: Dynamic Variable Creation from Forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-37568@lists.php.net to get a copy of this message | ||
Not *sure* i understand the problem, but this may be the solution:
$foo = "hello";
$bar = "foo";
$foobar = $$bar;
$foobar now contains "hello".
Gfunk - http://www.gfunk007.com/
I sense much beer in you. Beer leads to intoxication, intoxication to
hangovers, and hangovers to... suffering.
----- Original Message -----
From: "[ rswfire ]" <rswfire@hotmail.com>
To: <php-general@lists.php.net>
Sent: Thursday, February 01, 2001 11:28 AM
Subject: [PHP] Dynamic Variable Creation from Forms
> I have a problem I'm not sure how to fix.
>
> PART I
>
> I have a form on a page that creates its variables dynamically. Here's an
> example:
>
> mysql_db_query($db, "SELECT * FROM table");
> while ($row = mysql_fetch_array($result))
> {
>
> echo "<INPUT TYPE='CHECKBOX'
> NAME='chk_".$row["checkboxtype"]."'>";
>
> }
>
> PART II
>
> I need to make reference to these dynamically created variables. How do I
> do this? This does not work, obviously:
>
> $chk_.$row["checkboxtype"]
>
> Thanks in advance...
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com
>
>
> --
> 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
>