I was making registration form for my project and I have validated it using JavaScript only, It perfectly validates every field and works pretty well. I have made the submission of the form to database fully dependent on the JavaScript i.e using hidden type input fields to capture the JavaScript validated values and be submitted to the database. If JavaScript feature is disabled nothing will be submitted to database. I couldn't find any suitable realtime validator other than this for php form plus its my first time doing project. (The project is intended to work on local server in a company.) So I just want to know if I am doing the right thing. Please give me your suggestions on this.
In general, you should never rely on client-side validation, because you can't trust the client.
You can use client-side validation for real-time feedback, but always validate data on the server.
If JavaScript feature is disabled nothing will be submitted to database.
This assumes that the user only uses the interface you provided. In the background, the form submission only triggers a HTTP POST request to your server that can be modified (and sent from outside your application and thereby bypass your client-side validation completely).