Added information/examples about input checking (#21615)

* Added information/examples about input checking

* removed boilerplate
This commit is contained in:
Jacob Hoard
2018-11-17 11:43:56 -05:00
committed by Christopher McCormack
parent 54f73c9596
commit 42818b2271

View File

@ -1,13 +1,21 @@
---
title: Checking Required Inputs
---
## Checking Required Inputs
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/php/forms/checking-required-inputs/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
PHP has a few functions to check if the required inputs have been met. Those functions are ```isset```, ```empty```, and ```is_numeric```.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
### 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']
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->
if(isset($firstName)){
echo "firstName field is set". "<br>";
}
else{
echo "The field is not set."."<br>";
}
```