Get external variables (like form input) and filter them in PHP
Description
The following code shows how to get external variables (like form input) and filter them.
Example
<?php/*from w w w .j av a 2 s.c om*/
if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)){
echo "E-Mail is not valid";
}else{
echo "E-Mail is valid";
}
?>
/*
INPUT_GET
INPUT_POST
INPUT_COOKIE
INPUT_ENV
INPUT_SERVER
*/
The code above generates the following result.