note 49531 added to language.variables.variable
| From: | themayorbynightATgmail dot com at osu1 dot php dot net | Date: | Mon, 31 Jan 2005 21:56:45 +0000 |
| Subject: | note 49531 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84288@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/language.variables.variable.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49531
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49531&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49531&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49531&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49531&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49531&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49531&report=yes
Search -- http://master.php.net/manage/user-notes.php