Verify if the “email” input variable is sent to the PHP page using the “get” method.
<?php if (!filter_has_var(INPUT_GET, “email”)) { echo(“Email not found”); } else { echo(“Email found”); } ?> |
The filter_has_var() function determines if a variable of a specified input type exists.
It checks the content received by the PHP page, meaning the variable must be sent to the page, such as through a query string.
filter_has_var(type, variable) |
Parameter |
Description |
type |
Required. Specifies the input type to check for, which can be one of the following: · INPUT_GET · INPUT_POST · INPUT_COOKIE · INPUT_SERVER · INPUT_ENV |
variable |
Required. Specifies the name of the variable to check. |
Return Value: |
Returns TRUE if successful, FALSE if not. |
PHP Version: |
5.2+ |