RE: [PHP] Retrieving a list of field names
| From: | Ford, Mike [LSS] | Date: | Thu, 22 May 2003 17:09:42 +0000 |
| Subject: | RE: [PHP] Retrieving a list of field names | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-148580@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Daniel J. Rychlik [mailto:drychlik@tcsconsult.com]
> Sent: 22 May 2003 18:01
>
> I am relatively new to PHP, coming from a background in perl.
> I was wandering if their was a set function that would
> retrieve the field names from a HTML form. I have built a
> rather long HTML form and I wanted to use some shortcuts or
> smart function to retrieve the field name and their values.
> Rather than using a lot of $_POST = "fieldname" statements.
I think you may be slightly confused here. $_POST['fieldname'] is the way to refer to the
value of the form field with attribute name="fieldname" (assuming your form has
method="post"!). If you want to loop through all of the posted form fields, just do
something like:
foreach ($_POST as $fieldname=>$value)
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211