what is the shorted if else block for this. I seen it somewhere before but cant remember it.
if (isset($_POST[\'value\')){
$value = $_POST[\'value\'];
} els
Are you referring to using the $_REQUEST global array instead of checking both $_POST and $_GET? If so, it should be:
if(isset($_REQUEST['value']))
{
$value = $_REQUEST['value'];
}else
$value = '';
Or the ternary form:
$value = isset($_REQUEST['value']) ? $_REQUEST['value'] : '';
$value = filter_input(FILTER_POST, 'value') ?: filter_input(FILTER_GET, 'value');
Or if you have to get multiple variables, do this:
$input = $_POST + $_GET + $defaults;
$value = $input['value'];
(The + operator does not override existing keys in the left array; it works like array_merge($defaults, $_GET, $_POST)
in this case.)