Know which POST (or GET) method variables are available with php

Very easy script for a very important need: handle all variables coming with POST or GET methods.
With this script you can manage all data coming for every kind of form.

1
2
3
4
5
<?php
foreach ($_POST as $varname => $varvalue) {
 echo "$varname -> $varvalue<br>";
}
?>

This script prints all passed variables with their values.

There is nothing more to say, just remember that changing $_POST with $_GET you will list all GET variables instead of POST ones.

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.00 out of 5)
Loading ... Loading ...
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 2 comments

  1. venkat

    on November 3, 2007 at 9:03 am

    hi Emanuele ,
    thanks for ur code, i have completed my task with ur small code but effective. ok have a beer(brand ur wish)on my name :)

    once again thanx
    VENKATA

  2. Abe

    on March 9, 2010 at 2:22 pm

    Very useful :)