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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command to direct the search

Status
Not open for further replies.

3allawy

Programmer
Oct 19, 2005
28
CA
Hey guys... I'm a pretty new programmer, and I wonder if anyone can give help me. I am implementing the search functionality on a websie. I've developed a cold fusion form which has two buttons and a text field. Based on the text and depending on the selected button, the search should be directed in a certain direction.

What will be the command that I have to use to redirect the search.

Thx alot
 
Do you want to redirect the user based on keywords they typed in the search field? Or, redirect them based on the button clicked regardless of what keywords they typed?

If the latter, and there are several ways to do this, one way would is to redirect the user based on the button name.

For example, lets say this is your form:
Code:
<!-- ON FORM PAGE -->
<form name="form1" method="post" action="redirect_code.cfm">
	search field:&nbsp;    
	<input type="searchMe" name="textfield"><br/>
	<input name="GoLeft" type="submit" value="Go Left">
	<input name="GoRight" type="submit" value="Go Right">
</form>

<!-- ON 'redirect_code.cfm' PAGE -->
<cfif isdefined(FORM.GoLeft) and FORM.searchME NEQ "">
	<cflocation url="GoLeft.cfm" addtoken="no">
</cfif>

<cfif isdefined(FORM.GoRight) and FORM.searchME NEQ "">
	<cflocation url="GoRight.cfm" addtoken="no">
</cfif>

Now obviously, you would pass the search field values to the correct pages, otherwise all this is pointless.

And, if its the former then you need a list of keywords to loopthrough and if that word is found in the list then direct them based on that. If you need this option, have your list of keywords in the dB (makes maintaing them easy).


____________________________________
Just Imagine.
 
like this?

<cflocation url = " addToken = "no">

You may also want to replace the spaces in "searchMe" with "+" to make google happy.

<cflocation url = " ' ', '+', 'All')#" addToken = "no">


We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top