Form validation server side
Today we’ll consider data validation on server side with build-in php functions. Any html form is potential danger for your project because of information from this form. User not necessary wants to hurt you. He can enter some spaces. Spaces are not a problem, but you are recommended to store clean data.
In this tutorial we will consider several situations%
- xss injection detection – we will use strip_tags function
- remove spaces – we will use trim function
- if you wish to use html tags in input , for this purpose php has hot htmlspecialchars function. This function modify tags into html entities. You can find codes of these entities in Internet.
For example, this link.