Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
228,077 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.