Jump to content

[SOLVED] PHP Vs Javascript


adam84

Recommended Posts

I know totally different, but I just wanted to know if I do all my data validation after my form has been submitted is that considered to be good coding or should I do the validation first in javascript, then recheck everything in PHP. As of now, I am just doing everything in PHP because in a few past posts, people have said to validate the data in PHP because Javascript can be turned off. So if a user can turn their Javascript off, is it even worth validating in Javascript at all?

 

Thanks

Link to comment
Share on other sites

1.) Always validate server side.

 

2.) Add validation client side so that it is more user friendly. It is far nicer for the user to be told immediately that their username is not long enough than to fill out the rest of the form, wait a while, then be told. Not to mention lighter load on your server.

Link to comment
Share on other sites

As GingerRobot said, it's good to have the checking in there. Personally, I only validate via PHP, but I build my scripts to refill the form with previously submitted data to help ease the burden for having to fill out everything again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.