CGI search form - Searching multiple tables via dropdown

dwd2000

Member
Messages
163
Reaction score
0
Points
16
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:
Top