Skip to content

Instantly share code, notes, and snippets.

@kruxor
Created August 16, 2015 03:35
Show Gist options
  • Save kruxor/ad86a46f21dca9381012 to your computer and use it in GitHub Desktop.
Save kruxor/ad86a46f21dca9381012 to your computer and use it in GitHub Desktop.
Loop through post array checking that the method is post, using key and values.
<?php
if($_SERVER['REQUEST_METHOD']=="POST") {
$message = "";
foreach( $_POST as $stuff => $stuff_val ) {
if( is_array( $stuff ) ) {
foreach( $stuff as $thing => $thing_val) {
$message .= "$thing : $thing_val <br>";
}
} else {
$message .= "$stuff : $stuff_val <br>";
}
}
echo $message;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment