SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    oklahoma
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question JavaScript or PHP which one to use?

    I have a form that I want to link up to a database. I will have multiple select boxes on the form and some will be linked to the database while others will be hard-coded. I will use a SQL statement to return only the rows I want from the database based upon selections made from the select boxes, therefore I need to be able to get the values out of the select boxes as they are made. Am I better off using Javascript code for this type of form or can I mix up PHP and Javascript code to get what I want?

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    A mix of PHP and Javascript would be much more suited to this task.

  3. #3
    SitePoint Zealot tss68nl's Avatar
    Join Date
    Nov 2002
    Location
    Netherlands
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depends on what you can do easily with PHP without getting too bloated. Some people dont have javascript enabled, and certain browsers will react differently especially when it comes to accessing the HTML objects, and things like expando properties.

    When you can read and combine the input easily on the server side, then do it there, to make sure it works on all browsers.

    On the other hand, if that would mean you'd have to repost the page every line that is selected, then you are maybe better off marking those lines with javascript, combining their numbers, and sending them to the server. However, seeing you are talking about checkboxes, I think this is not the case here, and you can do without javascript.


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
  •