Validating form in php
When there are many fields in the form, the PHP validation script becomes too complex.
Each field in the form can have zero, one or more validations.We are also going to implement some basic security feature like sanitization and validation of the user's input so that user can not insert potentially harmful data that compromise the website security or might break the application.Input Validation is the outer defensive perimeter for your web application.There are two types of validation are available in PHP.
Such code can now do no harm and is safe to be displayed on a page or inside an e-mail. if quotes are escaped with a slash \ let's remove that.What it does is takes the data passed to the function, strips unwanted characters (extra space, tab, newline) from the beginning and end of the data using the PHP trim() function, strips any quotes escaped with slashes and passes it through htmlspecialchars().