What is the better language to validate form ? JavaScript Or Php, please I really need an answer. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the better language to validate form ? JavaScript Or Php, please I really need an answer.

I have created a JavaScript form validator, but I was told that Php can handle things more than JavaScript can please help me with your opinion and experience, Thanks.

17th Dec 2016, 5:39 PM
Elmahfoud Majidi
Elmahfoud Majidi - avatar
2 Answers
+ 1
client-side form validation (with Javascript) is faster and provides better user experience, but it's less secure as a hacker can bypass it easily. server-side form validation (with php or any other) provides worse user experience as the data has to be sent to the server and the page has to reload, and only then the user will know if the data is vaild, but it's safer as no one can bypass it. a balanced choice would be to implement form validation on both sides 😉
17th Dec 2016, 11:54 PM
Omar Einea
Omar Einea - avatar
0
so would be better if I check the user inputs first with JavaScript,so I make sure that the user has entered the proper information and that there is no Sql injection or any others, then pass the checked variables to Php right ?
18th Dec 2016, 12:04 PM
Elmahfoud Majidi
Elmahfoud Majidi - avatar