Page 1 of 1

finding _POST variables

Posted: Mon Sep 02, 2002 11:08 am
by boinnk
How do I find the variables in _POST?
I know i can use _POST['variable'], but I don't know the names of the variables.
$_POST[$i] doesn't work.
Any ideas?

Posted: Mon Sep 02, 2002 11:09 am
by boinnk
with $i I meant $_POST[0], $_POST[1], ....

Posted: Mon Sep 02, 2002 11:11 am
by Takuma
You can't use $_POST like $_POST[$i]. You have to use the name of the form inputs you set.

Posted: Mon Sep 02, 2002 11:15 am
by boinnk
Yeah, I know.
I was asking for a way of "finding" the variables in $_POST without knowing the names of them.
And not just

Code: Select all

<?php
extract($_POST);
?>
.

Posted: Mon Sep 02, 2002 11:19 am
by Takuma
Sorry...
How about using this

Code: Select all

<?php
while(list($key,$value) = each($_POST)) {
  echo "Key Name: ".$key."\n Value of the key: ".$value;
}
?>

Posted: Mon Sep 02, 2002 11:22 am
by boinnk
Thanks! That should do it.
Probably my poor english made it hard to understand my first question ;)

Posted: Tue Sep 03, 2002 12:56 am
by Takuma
I'm originaly Japanese so I too have not got good English... :roll: