+ Reply to Thread
Results 1 to 1 of 1

Thread: CGI search form - Searching multiple tables via dropdown

  1. #1
    dwd2000's Avatar
    dwd2000 is offline x10 Sophmore dwd2000 is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Left of Toronto.
    Posts
    161

    Question CGI search form - Searching multiple tables via dropdown

    They say "A picture is worth a thousand words", so I'll show the original search script, then the planned changes.
    Note: I can't test it due to the fact that I have no data in the database yet. This is Profile Manager I'm working with and I'm using it as a Classmates type application, where people can search for other people. The database will be filled with various info, like the different schools they went to, the different places they have lived, and even different last names for women. Yes, there is a lot of info to gather and search.

    Here's the original code:
    -----------------------------------------------------------------

    <form action="search.cgi" method="get"> <input
    name="action" value="search" type="hidden">
    <select name="infield">
    <option selected="selected" value="any">Any
    Keyword
    </option>
    <option value="login">login
    </option>
    <option value="email">email
    </option>
    <option value="age">age
    </option>
    <option value="state">State
    </option>
    </select>
    <input name="words" size="15" value="%%words%%"
    type="text">
    <input name="search" value="search" type="submit"></form>
    -----------------------------------------------------------------------------------

    These are the planned changes:
    ----------------------------------------------------------------------------------

    <form action="search.cgi" method="get"> <input
    name="action" value="search" type="hidden">
    <select name="infield">
    <option selected="selected" value="any">Any
    Keyword
    </option>
    <option value="Firstname", "lastone","lasttwo", "lastthree">First and Last Name
    </option>
    <option value="locationone", "locationtwo", locationthree">Location
    </option>
    <option value="schoolone", "schooltwo", "schoolthree">School
    </option>
    </select>
    <input name="words" size="15" value="%%words%%"
    type="text">
    <input name="search" value="search" type="submit"></form>
    ------------------------------------------------------------------------------------

    My logic - The program will search in each table to find the info, but does CGI have the same logic?
    Would it be better to predefine separate values first, then search for the new values?
    Example: (I'm not sure how exactly, but maybe something like this)
    ------------------------------------------------------------------------------------

    <"lastname" value= "lastone", "lasttwo", "lastthree">
    <"name" value= "firstname", "lastname">
    <"location" value= "locationone", "locationtwo", "locationthree">
    <"school" value= "schoolone", "schooltwo", "schoolthree">

    <form action="search.cgi" method="get"> <input
    name="action" value="search" type="hidden">
    <select name="infield">
    <option selected="selected" value="any">Any
    Keyword
    </option>
    <option value="name">First and Last Name
    </option>
    <option value="location">Location
    </option>
    <option value="school">School
    </option>
    </select>
    <input name="words" size="15" value="%%words%%"
    type="text">
    <input name="search" value="search" type="submit"></form>
    --------------------------------------------------------------------------------------------

    NOTE: This is just a sample. There can actually be up to ten values for each option.
    I know I have the option of just using "Any", without the drop down.

    Any suggestions would be greatly appreciated.
    Last edited by dwd2000; 02-19-2008 at 02:46 PM.

    Thirty years ago I was young and foolish.
    Now, I'm just young.


+ Reply to Thread

Similar Threads

  1. A simple Visual Basic Login Form
    By Zenax in forum Tutorials
    Replies: 0
    Last Post: 03-13-2007, 08:59 AM
  2. [90 Points] Theme Tables form
    By N2PGames in forum The Marketplace
    Replies: 4
    Last Post: 03-14-2006, 11:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers