This is a function I use to test for POST variables which have been passed to my scripts.
It can be modified easily to do the same for variable passed by the GET method, cookies and uploaded files.
Its nothing exciting but saves on typing. Feel free to use.
PHP Code:
/* this function tests for the presence of HTTP post variables passed to the current script
it takes a list containing a variable number of arguments pertaining to the variable name
as set in the name attribute of the form input tags
if all variables passed as arguments are set - the function returns true
if any variables are not set the function returns false
this function is very similar to the isset() function - but saves having to write $_POST
for each variable you want to test
*/
function posted () {
$arglist = func_get_args ();
foreach ($arglist as $arg)
if (! isset ($_POST[$arg])) return false;
return true;
}