Connecting Tech Pros Worldwide Forums | Help | Site Map

form validation

Familiar Sight
 
Join Date: Oct 2008
Posts: 128
#1: Oct 14 '09
i want to know what is most trusted way for form validation
javascript or php??
i also want to know what technology is used by naukri.com

TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#2: Oct 14 '09

re: form validation


Javascript can be turned off, PHP can't. You should have both as validation, but you should ALWAYS have PHP validation. Javascript validation is to avoid wasting time/resources with posting forms that have an error or mistake.

With regards to the website you want us to analyse, if you type in a mistake in the form and press submit, and a window comes up and it doesn't send, they use javascript. if you turn off javascript and type in a mistake and an error comes up after the form has been sent, then it's PHP. Again, they should have both.
Familiar Sight
 
Join Date: Oct 2008
Posts: 128
#3: Oct 14 '09

re: form validation


Quote:

Originally Posted by TheServant View Post

Javascript can be turned off, PHP can't. You should have both as validation, but you should ALWAYS have PHP validation. Javascript validation is to avoid wasting time/resources with posting forms that have an error or mistake.

With regards to the website you want us to analyse, if you type in a mistake in the form and press submit, and a window comes up and it doesn't send, they use javascript. if you turn off javascript and type in a mistake and an error comes up after the form has been sent, then it's PHP. Again, they should have both.

thanx for your valuable suggestions
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#4: Oct 14 '09

re: form validation


Quote:

Originally Posted by kkshansid View Post

thanx for your valuable suggestions

No problem. Let us know how you go, Google has tonnes of resources in techniques for both javascript and PHP.
Familiar Sight
 
Join Date: Oct 2008
Posts: 128
#5: Oct 16 '09

re: form validation


Quote:

Originally Posted by TheServant View Post

No problem. Let us know how you go, Google has tonnes of resources in techniques for both javascript and PHP.

i got script in php for form validation is working well with little additional coding but the problem is that their is no postback of data in php validation .

as naukri.com post back data and its also in php
i think there must be some way to post back data in php
is there any method to postback data in php???
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#6: Oct 18 '09

re: form validation


I don't know what you mean by postback data? If your PHP script is just above the html which contains your form, you can do something as simple as:
Expand|Select|Wrap|Line Numbers
  1. echo "<p>Form submitted successfully</p>"
Ultimately you will need to learn about $_SESSION which will let you display messages anywhere you want, but I think a simple echo is much easier.
Familiar Sight
 
Join Date: Oct 2008
Posts: 128
#7: Oct 19 '09

re: form validation


ya i did post with echo.thanx
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 919
#8: Oct 19 '09

re: form validation


No worries, but do look into $_SESSION's and temporary $_SESSION's as they will be a good tool for errors and warnings.
Reply