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 (No Ratings Yet)
Loading ... Loading ...
If you found this post useful, please consider a small donation.

2 Responses to “Know which POST (or GET) method variables are available with php”

  1. venkat on November 3rd, 2007 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 9th, 2010 2:22 pm

    Very useful :)

Leave a Reply




flash games company