-5

I have made a calculator in PHP and it works fine. But I haven't used validation. What do you guys think, should I use Javascript or PHP for validation?

user5237857
  • 86
  • 1
  • 8

3 Answers3

2

As a general rule think this: Server side validation is mandatory: not validated data could harm your app or be used in a wrong way

Client side validation is more used to help users to fill correctly your forms, but you can't trust it, as client data could be easily altered from users

Of course, the best would be to use the two together

Moppo
  • 18,797
  • 5
  • 65
  • 64
2

It depends on your requirements.

  • If you want to speed up your output, but give less priority to security, then use client side scripts such as JavaScript.
  • If you want more security and wouldn't care for speed, then use server side scripts such as PHP.
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
Manikiran
  • 2,618
  • 1
  • 23
  • 39
0

Better you can have both Client Side and Server Side validation.

Server Side validation will help if user disabled Javascript on his Browser

Anto S
  • 2,448
  • 6
  • 32
  • 50