form validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kkshansid
    New Member
    • Oct 2008
    • 232

    #1

    form validation

    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
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    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.

    Comment

    • kkshansid
      New Member
      • Oct 2008
      • 232

      #3
      Originally posted by TheServant
      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

      Comment

      • TheServant
        Recognized Expert Top Contributor
        • Feb 2008
        • 1168

        #4
        Originally posted by kkshansid
        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.

        Comment

        • kkshansid
          New Member
          • Oct 2008
          • 232

          #5
          postback data in php

          Originally posted by TheServant
          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???

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            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:
            Code:
            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.

            Comment

            • kkshansid
              New Member
              • Oct 2008
              • 232

              #7
              ya i did post with echo.thanx

              Comment

              • TheServant
                Recognized Expert Top Contributor
                • Feb 2008
                • 1168

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

                Comment

                Working...