Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining Search functionality - Help needed, please

Status
Not open for further replies.

chinedu

Technical User
Mar 7, 2002
241
US
I have 5 different databases, all on same server.
Then I created a static dropdown list box that has 4 fields:
Street Name, Basin, zoning and city.
This will have a title saying Search By:
This allows you to search by any of the fields listed above.
Each of these fields has its on database.
But I need to create search code that will allow the user to select a field, say, street name, and he/she will be take to search form where he/she searches for information that will display street name values if there is one.

My question then is, that way I am thinking it right now, is to create 4 different search functionalities, one for each of the fields listed above.
This way, if the user's selection is, say, street name, the user will be automatically taken to "search street" info page.
Meanwhile, all of these will be transparent to the user.
In other words, the user will be thinking that he/she is always taken to one search form to perform various search funtions.
Can I please get your input on this?
Thanks in advance.
 
Hi,

I'm not sure if I understand at all what you want to do.

If you mean that you want to do a different type of search depending on the user's selection, it can be easier than that:

Just give a value to each search type in that dropdown combo. Lets say, Street would have value 1, Country would have value 2, and so on. Then you have a textbox in that same screen, so the user can select the place to search (lets say Street) and then type in the text. When clicking the "Search" button you justo go to a result page where you display the search.

Of course, you code the page in a way like this:

if search_value = 1 then connect to street database and search what the user said.
if search_value = 2 then connect to country database and search what the user said.


If you want to have a different form to search... this is, click on the dropdown list and THEN allow the user to type things, it is easy.

Create a function in JavaScript that does something like this:

function jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

Then in the dropdown list you put the following code:

<select name='list' onchange=&quot;jumpMenu('self',this,0)&quot;>
<option value=&quot; to display
<option value=&quot; to display
</select>


This way when a users clicks on a selection, he/she gets redirected to the page you specify.


Anyway, I'm not sure if this is what you wanted. If not please feel free to explain a bit more about it so I can try giving a better answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top