Reputation: 23
I'm working in a learning project of software using PHP in Backend and the big 3 in front (HTML,CSS,JS). I'm not sure where to validate data inputs if in PHP or Javascript
Upvotes: 1
Views: 50
Reputation: 4481
At least in backend, and for the best user experience, in frontend and backend.
If you just do the validation in frontend, a malicious user could send incorrect data to the backend using a simple script bypassing all your javascript validations. That is why you should always validate at least in the backend.
The user experience will be better duplicating the validation in the frontend because the user will receive feedback without having to wait for a request to be answered by the server.
Upvotes: 3