Files
freeCodeCamp/guide/english/php/forms/checking-required-inputs/index.md

22 lines
487 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Checking Required Inputs
---
## Checking Required Inputs
2018-10-12 15:37:13 -04:00
PHP has a few functions to check if the required inputs have been met. Those functions are ```isset```, ```empty```, and ```is_numeric```.
2018-10-12 15:37:13 -04:00
### Checking form to make sure its set
The ```isset``` checks to see if the field has been set and isn't null.
Example:
```php
$firstName = $_GET['firstName']
2018-10-12 15:37:13 -04:00
if(isset($firstName)){
echo "firstName field is set". "<br>";
}
else{
echo "The field is not set."."<br>";
}
```