Page 1 of 1

$_POST & Arrays

Posted: Mon Feb 02, 2004 12:43 am
by evilcoder
hey guys, maybe you can give me a hand with this concept.

I have a form with 3 Fields (the names of the fields are unknown as they are user defined).

Now when a user enters the details for this form, the script converts, using a foreach, the $_POST's into an array as $field=>value, so the array would look like this:

"(the field name)" => "(The Value of that field)" ,
etc etc etc

Is this clear, and can it be done. Using _POST to create an array.

What i'm truely aiming at is having a script that processes form completely autonomously and without prior Formname configurations.

Thanks.

Posted: Mon Feb 02, 2004 3:55 am
by evilcoder
refresh.

Posted: Mon Feb 02, 2004 4:12 am
by Wayne
straight from the manual

Code: Select all

while (list ($key, $val) = each ($HTTP_POST_VARS)) {
echo "$key => $val<br>";
}

Posted: Mon Feb 02, 2004 6:52 am
by Nay
Also:

Code: Select all

foreach($_POST as $key => $val) {
   print $key . " => " . $val;
}
-Nay