Here is the function:
function is_set($var, $placeholder = null){
if(isset($var)){
return $var;
} else {
return $placeholder;
}
}
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
is_set($_POST['freq'], '');
}
It returns "Notice: Undefined index: freq in... "
While this code works well:
echo isset($_POST['freq']) ? $_POST['freq'] : '';
Why is that??