SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: js and php

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2011
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb js and php

    Hi

    When making froms,

    Is it considered good practice to have javascript validate form fields and php to refer to database.

    Or is it better to php validate form fields and talk to database

  2. #2
    SitePoint Addict skunkbad's Avatar
    Join Date
    Apr 2008
    Location
    Temecula, CA
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I like to do simple checks with javascript. A lot can be done to ensure that the site visitor fills out the form correctly, but you should always do true validation on the server. The reason for this is that javascript can be turned off, or data could be posted to your controller bypassing your form altogether!


Tags for this Thread

Bookmarks

Posting Permissions

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