Input field is a common element that will be used in web development.
<input type="text" name="username">
Thus, it is important for you to validate your input field.
Why???
Because of the security reasons.
If you are not validating your input field, your web application will be vulnerable to attacks such as:
SQL Injection & Cross-Site Scripting
SQL INJECTION
SQL Injection is a type of attack by tricking the database, bypass authentication, and manipulate data in database.
So how to prevent your web application from this attack?
1. Escape special character in input parameters
2. Use stored procedures
Cross-Site Scripting
If your input field is able to accept a "javascript script", that means your web application is vulnerable to attack.
This type of attack can be used to gain session id.
