www.webdeveloper.com
Results 1 to 10 of 10

Thread: Search with multiple drop down boxes

  1. #1
    Join Date
    Mar 2012
    Posts
    20

    Wink Search with multiple drop down boxes

    Hi
    I have a search pege in my website.I am developing in PHP/MYSQL.
    search page contains three drop down boxes
    1:Country
    2:Education
    3:age

    Country contains:All,US,Canada etc
    Education Contains:All,Highschool etc
    Age Contains:All,20,21,etc

    How can i write sql statement to satisfy this criteria to get values from database.

    Thank you so much for your help

  2. #2
    Join Date
    Oct 2009
    Posts
    658
    Use AND in your Where clause
    Good Luck

    Santos Systems

  3. #3
    Join Date
    Nov 2007
    Posts
    413
    If "All" is chosen for any drop-down, exclude that from the WHERE clause. Since any (or all) of the items may be "All" you will need to make sure that your first "where" condition uses "WHERE" and not "AND" (e.g., if the user chose "All" for Country, then the statement would be "WHERE education=..." not "AND education=...")

    Select * from TABLE
    WHERE country = <selected country>
    AND education = <selected education>
    AND age = <selected age>

  4. #4
    Join Date
    Apr 2012
    Posts
    14
    Hi aneesh29!

    I think I can help you with this one because I done one like this. just checj here if it's the way you want. in my case you can choose one OR more critery t do your search.. here's the link

    http://scale24-25.com/search-db-foreach.php

    rigth now I try to expend this search to an other level.. but got some problem... I will post it on an other thread.

    so let me know if it's what you want. if yes drop me a mail I will send you the code for them

    hope it will help

    S

  5. #5
    Join Date
    Mar 2012
    Posts
    20
    hi thanks for your reply
    i am looking exact search form like you.
    can you please send me the code.
    Thank you so much

  6. #6
    Join Date
    Apr 2012
    Posts
    14
    hi!! check this thread..

    http://www.webdeveloper.com/forum/sh...51#post1202651


    you can took the 2 first batch of code it's my files

    yours

    S

  7. #7
    Join Date
    Apr 2012
    Posts
    2
    Hi scaleautostyle

    The code you have produced is exactly what I am looking for

    Can you please send me your code please. I would like to narrow a user result depending on the criteria they choose via the drop down menu.

    I really appreciate your help with this

    many thanks

    shalli

  8. #8
    Join Date
    Apr 2012
    Posts
    14
    hi!! jsut go in the thread I post before. copy clip the code into your file and VOILA.

    yours

    S

  9. #9
    Join Date
    Apr 2012
    Posts
    2
    Hi scaleautostyle

    I got confused because you said you got a error

    did you modify all the php code

    just confused can you zip and send me the files please

    if not then no problem

    thanks for your response

    shalli

  10. #10
    Join Date
    Apr 2012
    Posts
    14
    the first 2 files are in working condition like they are in the site rigth now. the non working one are after.

    yours


    S


    PS: I don't send any file by mail due to some problem in the past on other forum.

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