How can I iterate over 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
aneuryzma
Forum Contributor
Posts: 106
Joined: Sat May 17, 2008 7:03 am

How can I iterate over POST variables ?

Post by aneuryzma »

WHen I want to get a POST variable I use $_POST["VARIABLENAME"].

What if I don't want to specify the variable name, and let's say iterate over all variables in a loop ?
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: How can I iterate over POST variables ?

Post by Eric! »

Code: Select all

foreach($_POST as $key=>$value){
echo $key." = ".$value;
}
Post Reply