finding _POST variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
boinnk
Forum Newbie
Posts: 22
Joined: Fri Jul 26, 2002 9:53 am
Location: Sweden

finding _POST variables

Post 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?
boinnk
Forum Newbie
Posts: 22
Joined: Fri Jul 26, 2002 9:53 am
Location: Sweden

Post by boinnk »

with $i I meant $_POST[0], $_POST[1], ....
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

You can't use $_POST like $_POST[$i]. You have to use the name of the form inputs you set.
boinnk
Forum Newbie
Posts: 22
Joined: Fri Jul 26, 2002 9:53 am
Location: Sweden

Post 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);
?>
.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post 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;
}
?>
boinnk
Forum Newbie
Posts: 22
Joined: Fri Jul 26, 2002 9:53 am
Location: Sweden

Post by boinnk »

Thanks! That should do it.
Probably my poor english made it hard to understand my first question ;)
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

I'm originaly Japanese so I too have not got good English... :roll:
Post Reply