SitePoint Sponsor

User Tag List

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

    What do I use, PHP or Javascript code

    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
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd suggest PHP all the way

  3. #3
    Are You There? KDesigns's Avatar
    Join Date
    Oct 2003
    Location
    Your Monitor
    Posts
    1,146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Definitley PHP all the way just like astericks suggested.
    ChooseDaily.com - Follow on Twitter
    Top Resources for Web Designers and Developers Every Day!

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    oklahoma
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to use an item selected in selectbox1 as a basis for an SQL statement to pull up data from my database. I cannot figure out how to do this in PHP. I am new to this and from my understanding you cannot do this type of scripting (client side) in PHP. So how do I do this? I cannot read any variable that has been selected. I cannot remember how I coded this earlier because I have been through so many iterations but one of the errors I was getting was that the object was null or not defined. I don't know how to correct this.... can you help?

  5. #5
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd ask the user to select the item, press submit and then display whatever options you need.

    does this make sensE?

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    USA
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This php method requires a page reload then..I think the author said in the javascript forum he didn't want that?

    I would clarify to say the first form element would be setup as a jump menu to refresh the page. Then when the page reloads you would plug $HTTP_POST_VARS['fieldname'] into the SQL for the second recordset needed for the second form field.


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
  •