RE: [PHP] Getting at the variable name itself
| From: | John Holmes | Date: | Wed, 25 Sep 2002 04:11:14 +0000 |
| Subject: | RE: [PHP] Getting at the variable name itself | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117502@lists.php.net to get a copy of this message | ||
> Hi. I'm putting together a form that needs to have multiple pairs of
both
> text inputs and checkboxes. On the submit page I need to be able to
> associate one with the other, and the variable names themselves have
other
> identifying values embedded in their names. What I need to know is
how do
> I
> access the variable name? Suppose I have a variable name like this:
>
> $method_valueA_valueB
>
> I intend to use the name itself as a string I can then explode to
recover
> the embedded data.
>
> How do I operate on the variable name itself?
You can't, AFAIK. You'd probably be better off by naming your input
elements as arrays.
<input type="text" name="method[A][B]">
etc... and then access it by $method['A']['B']...
---John Holmes...