PHP Build a Basic PHP Website (2018) Adding a Basic Form Validating Form Data

question about filter_input() func


anybody can clear what is the use of the filter_input?

lets take for exmaple this line:


as far as i see this func let us filter a input from the form with advanced settings. for exmaple if i want to filter an email then i have the "FILTER_SANITIZE_EMAIL" which Remove all characters except letters, digits and !#$%&'*+-=?^_`{|}~@.[].

we used "INPUT_POST" because we submit our form with POST method?

The second variable according the docs is for "Name of a variable to get.", we will always would want to put the variable in the "name" tag in our form inputs? only the values in the names tag are being sent to the servers

any help will be appreciated :]

2 Answers

Steven Parker
Steven Parker
206,355 Points

I'm not sure what you're asking, you seem to have described what this code is doing.

For more details, see the PHP manual page on filter-input.