Search With Drop Down Menu Form

Discussion in 'Programming' started by micksss, Jan 22, 2008.

  1. #1
    I've trying to figure out the best option to create a search form with drop down menus for the search options.

    Does anyone know of a script that I can use to create a database with all of the categories that creates the interface for the search form as well?

    Or do I have to create a mysql db or flat file with all of the categories and create the PHP to do the search myself?

    Thanks!
     
    micksss, Jan 22, 2008 IP
  2. micksss

    micksss Notable Member

    Messages:
    4,427
    Likes Received:
    268
    Best Answers:
    1
    Trophy Points:
    285
    #2
    micksss, Jan 22, 2008 IP
  3. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can do a file (flat or xml) or MySQL to populate the drop down list. As presumably you wont be changing the options that frequently it would be sensible to cache the results to save processing time each time the ddl is displayed.
     
    AstarothSolutions, Jan 23, 2008 IP
  4. sharqi

    sharqi Guest

    Messages:
    105
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I personally would go with the flat file option, and have the interface for adding new options (presumably some kind of admin panel) refresh the cache each time something is added to the table (the one flat file is based upon.)


    http://www.codewalkers.com/c/a/Database-Code/Populate-dropdown-box-with-MySQL-table-fields/

    This is the basics of creating a drop down, and frankly unless you have a very trafic heavy site then the db soloution should be just dandy for you. Just remember to close mysql connections when you are done with them!
     
    sharqi, Jan 24, 2008 IP
  5. micksss

    micksss Notable Member

    Messages:
    4,427
    Likes Received:
    268
    Best Answers:
    1
    Trophy Points:
    285
    #5
    Thanks for your help. I'll work on it and post back with my results. Thanks again!
     
    micksss, Jan 24, 2008 IP
  6. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #6
    It would depend on if you need to enforce data integrity - with a db you can use a foreign key to ensure you dont cause issues with changes with a flat file you dont have the luxury so it depends on what the use is etc... for this case it certainly does seem that there wouldnt be a desire need for foreign keys etc
     
    AstarothSolutions, Jan 24, 2008 IP