Thursday, October 25, 2012

Iterate through POST in PHP

When linking PHP scripts with HTML Forms, sometimes it is useful to iterate through all the elements passed to the script from the POST event.  Here is a snippet of code that does that:

foreach($_POST as $key=>$value)
{
echo "$key: $value\n";
}
php?>

This little code snippet can really come in handy when debugging a PHP script that receives data by POST.