#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    11
    Rep Power
    0

    dropdwon menu selection ---> SEARCH


    Hello everyone, thanks for stopping. here is my issue. i want to have a search engine with a drop down menu. i got the standard search engine to work but here is my problem. i want the user to select a category to search and get a result in that category. something along the lines of this:

    book store example:

    If 'Title' selected
    Search Title Column (in database)
    If result is clicked
    Show entire record


    Any suggestions would be greatly appreciated.
    -clue
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Posts
    117
    Rep Power
    17

    list menu


    --------------------------------------------------------------------------------
    i want the user to select a category to search and get a result in that category. something along the lines of this:
    -------------------------------------------------------------------------------

    something like this?

    http://www.196.39.77.117/shop/html/search.php
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    11
    Rep Power
    0

    dropdown menu selection ---> SEARCH


    Gumball, thanks for the quick reply but the link doesn't work

    -clue
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Posts
    117
    Rep Power
    17

    hehe, no wonder.


    paste this into your browser...

    196.39.77.117/shop/html/search.php

    I must be falling aslepp here!!!

    b4ll.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    11
    Rep Power
    0
    ok, something along those lines but when you select from the menu, next to the selection is a text box to type in what you're looking for in the category. for example, if i know the title of the books, i can select title in the drop down menu and then type in "Ender's Game" in the text box and then hit search. if it finds the book, i can click on it and get the price, seller, ISBN, etc.

    H-E-L-P! i hope this helps you.
    -clue
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Posts
    117
    Rep Power
    17

    searching your db


    well, still not clear about it, maybe tis helps.

    Build your form and add all field you require!
    From what I understand you want a drop down list, listing all categories and then a text box next to it so that you can specify more about the search in your own words...

    So your form will have:

    1. A drop down list (listing all categories)
    2. A text field (for matching a word in that category)

    the Sql query you looking for is something like this...

    $query = "SELECT * from $YourTable WHERE category='$YourCategory' and word LIKE \"%$YourtextboxValue%\";

    I am probably being as unclear as you
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    11
    Rep Power
    0
    gumball, you totally get what i'm trying to explain (i'm sorry when i'm frustrated i can get confusing) but thatnks for the effort. that line of code that you showed me gave me a better idea of what's going on but looking at the code that i have so far, i don't have anything defined as 'category' but i have 'option' and 'option value'. do i have to set up a 'category'? if so, do you know how i would go about it. thanks again

    -clue
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Jersey
    Posts
    14
    Rep Power
    0
    try http://199.184.166.118/oii and let me know if that's something like what you mean... any one know if there is a variable defined that's an array of all incoming variables to a php page? and how do i 'use' it? (sorry to hijack your post ) thanks... (will probably start a new thread...)
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Jersey
    Posts
    14
    Rep Power
    0
    Was going to edit previous post, but though i'd bump it up with an explination;

    I have the same (/very similar) search going on. With the results though, i have php generage "<a href = page.php?id>result</a>" kinda code for each displayed result... get it? so you get a book and in the database, that book as an id which you pass to page.php (in my example page - datasheet.php) which pulls all the information for the id passed to it...

    PHP Code:
        echo "<table class=td1 bordercolor=\"#FFFFFF\" bgcolor=\"#E2E2E2\" border=1 width = \"75%\" cellpadding=\"0\" cellspacing=\"0\"><tr align = left><th>Lubricants</th><td></td><th align = \"right\">Compare</th></tr>\n"
        
    $nbrow=0;   //Local variable to count number of rows 

        // fetch the succesive result rows 
        
    while( odbc_fetch_row$cur ) ) { 
            
    $nbrow++; 
            
    $lubricant odbc_result$cur2);
            
    $datasource odbc_result$cur);
            if(
    $datasource == "plant")
            {
                
    $color "width = \"50\" bgcolor=\"#996666\"";
            }
            else
            {
                
    $color "width = \"50\" bgcolor=\"#336666\"";
                }

            echo 
    "<tr><td><a href = \"datasheet.php?lubricant=$lubricant\">$lubricant</a></td><td ".$color."></td><td align = \"right\"><input name=\"compare\" type=\"checkbox\" value=\"".$lubricant."\"></td></tr>\n"
        } 

        echo 
    "</table>"
  18. #10
  19. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    11
    Rep Power
    0
    rweston002
    thanks a lot for that sample, i will certainly try it out. hopefully it can bring some help to me. i'll keep you can the rest of the forum posted on my progress
    -clue

IMN logo majestic logo threadwatch logo seochat tools logo