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! While you're at it, check out some resources Treehouse students have shared here.
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<noob />
17,062 Pointsquestion about filter_input() func
Hey.
anybody can clear what is the use of the filter_input?
lets take for exmaple this line:
<?php
filter_input(INPUT_POST,"username",FILTER_SANITIZE_STRING)
?>
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
<noob />
17,062 PointsSteven Parker
231,275 PointsI'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.