RE: [PHP] Reading Posted variable names
| From: | John W. Holmes | Date: | Thu, 06 Feb 2003 00:56:08 +0000 |
| Subject: | RE: [PHP] Reading Posted variable names | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134528@lists.php.net to get a copy of this message | ||
> I am trying to write a quick form->mail script (like Matt's) and I am
> stuck
> on one small part:
>
> form:
> <form method=post action=form.php>
> <input type=text name='field1'><br>
> <input type=text name='field2'><br>
> <input type=text name='field3'><br>
> <input type=text name='field4'><br>
> <input type=text name='field5'><br>
> <input type=text name='field6'><br>
> <input type=text name='field7'><br>
> <input type=text name='field8'><br>
> <input type=text name='field9'><br>
> <input type=text name='field10'><br>
> <input type=text name='field11'><br>
> <input type=submit value='Go'>
> </form>
>
> Form.php (receiver of the form post):
> foreach($_POST as $x) {
> print "$x<br>";
> }
>
>
> Will output the values of field1, field2, etc
>
> BUT - how do I get the field names on the form.php page? I want to be
> able
> to display:
> field1: value of field 1
Foreach($_POST as $key=>$value)
{ $msg = $key . ":" . $value; }
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/