If you check the contents of a post variable that never got passed, you get warnings. If you like keeping your verbosity set that high and want to avoid this warning, or you just want to avoid checking against a non-existent variable, try this:
<?php
/**
* Check to see if a POST variable is set and see if it's empty.
* Return false if not set, null, empty, etc.
*/
function ispostset($post_var)
{
if (isset($_POST[$post_var]))
{
if ($_POST[$post_var] != '')
{
return true;
}
else
return false;
}
else
return false;
}
?>
Now you can collect post variables like this in your code:
if (ispostset("some_post_var"))
$my_var = $_POST['some_post_var'];