note 49531 deleted from language.variables.variable by nlopess
| From: | nlopess@php.net | Date: | Tue, 01 Feb 2005 11:18:17 +0000 |
| Subject: | note 49531 deleted from language.variables.variable by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84312@lists.php.net to get a copy of this message | ||
Note Submitter: themayorbynight AT gmail.com
----
Hello, everyone. I'm new to PHP so you'll have to forgive any inefficiency or otherwise
'bad' coding practices. I have a unique situation of trying to access posted form
variables with 'dynamic' variable names. Heres the situation:
On one page, using a series of loops & a database, PHP creates a standard <form> on a
page. For each new person in the database, it creates a new text box that is for the person's
age. I wrote the PHP so that when it produces the code for the name of the form variable, the name
of the varialbe is {PERSONSNAME}_age. So, when it creates the text box for Georges name the name of
the text box is George_age, the one for Zelda is Zelda_age and etc. When I post these to a form
handling PHP script, when I use the statement "echo $P_Zelda_age" it outputs the right
value, however I am having trouble figuring out how to access these variables for code that
doesn't already know what names are coming in (for example, I don't have a way to access
$P_sam_age, if this person were to be added to the database). Any ideas? is there any way to perhaps
put all form input into an array that I can access?
Thanks,
TheMayorByNight@gmail.com