www.webdeveloper.com
Results 1 to 7 of 7

Thread: Is there a GO-TO PHP script for processing FORMS??

  1. #1
    Join Date
    Feb 2012
    Location
    Sacramento, CA
    Posts
    64

    Is there a GO-TO PHP script for processing FORMS??

    or do most PHP programmers simply validate and send their forms by coding it themselves??

    Also, should I be using Javascript field validation in conjuction with PHP or validate the data and process the form entirely with PHP?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,152
    Most PHP frameworks (CodeIgniter, Zend, etc.) have some sort of form processing/validation library.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Feb 2012
    Location
    Sacramento, CA
    Posts
    64
    Great, what about the javascript question?

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,152
    JavaScript validation would only be for user convenience (which is not a bad thing, mind you), but it is easily bypassed, so you still have to do any "important" validation on the server side.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Feb 2012
    Location
    Sacramento, CA
    Posts
    64
    Then why not just do all the validation on the server side? Why make validation so complicated..

  6. #6
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,152
    Because if it's something like validating that a field is an integer between 1 and 100, you can validate that on the browser side (JavaScript) and not have to send a HTTP request to the server, wait for the response, and then redisplay the page with the desired error message when you find out they entered
    "-123.59". Not a big deal, and something that can be added when you have time, or never if you don't feel it's important and server response time is seldom an issue on your site -- just another tool in your toolkit when it makes sense to do it. (And if you code your JavaScript every bit as modularly as you code your PHP and make use of JavaScript frameworks where it makes sense to do do, then it does not have to take all that much work to do -- beyond the learning curve of using a new framework and such.) Like pretty much everything else in this business, there's never one correct answer: it all depends on specific requirements, time, and budget.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  7. #7
    Join Date
    Feb 2012
    Location
    Sacramento, CA
    Posts
    64
    Wow thanks..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles