Input Var

A Simple function that gets a post or get variable if set or returns a default

<?
function input_var($name, $default = FALSE) {
	if (isset($_POST[$name])) {
		return $_POST[$name];
	} elseif (isset($_GET[$name])) {
		return $_GET[$name];
	} else {
		return $default;
	}
}
?>

Usage

when you are trying to get use input, just call input_var and pass the name of the variable you want to get and a default value to return if it can't find the variable in $_GET or $_POST.


Comments

Add your comment