PDA

View Full Version : Search engines


andy106
09-15-2005, 11:32 AM
hi,

I have managed to create a simple search engine for my site using a database. The problem that i have is that, not only do i want my search engine to display the results (which i have done) but i also want the results page to show the word or phrase that the user typed in to get the results.

e.g. This will be displayed above the results:

You searched for :..............

Thankyou

davidj
09-15-2005, 12:41 PM
what language are you using for your search engine?

page 1 is your form and are passing the variables to page2 [recordset]

you may have something like...

$_POST['field1']

which will be assigned to a variable name like $findthis;

$findthis = $_POST['field1'];

Just echo your var where you want it

$findthis = 'your search was for '. $_POST['field1'];

echo $findthis;

andy106
09-15-2005, 12:54 PM
I am using ASP VBscript.

This is the code for the search form:

<form action="index02.asp" method="get" name="Search_Results" id="Search_Results">

<input name="Search" type="text" id="Search">
../images/magnifiying-glass.jpg
<input type="submit" name="Submit" value="Search">
</a>../images/pagedesign-sliced03_07.jpg
</form>

I am going to try your suggestion

cheers

andy106
09-15-2005, 01:07 PM
forgot to mention that i have directed the form to display the results on the same page. In other words, when you click on the search button, the search button is directed to the same page.

davidj
09-15-2005, 01:28 PM
i see you are using the GET method

not too familiar with asp syntax.

what ever you are using to catch your textfield value > ($_Get['textfield'])

just write that back to the page

echo, print, write ?????? not sure of asp syntax but you will know what i mean
eg....


$searchthis = $_Get['textfield'];

echo $searchthis;

andy106
09-15-2005, 02:29 PM
hi,

I have created a search page using VBScript. I would like to know how you display the text, that the user typed into the search text box.

For example:

You searched for: ? -what code do i put here?


If this helps, this is the code for the search form, that has a text field and a 'submit' button:

--------------------------------------------------------------------------------
<form action="index02.asp" method="get" name="Search_Results" id="Search_Results">


<input name="Search" type="text" id="Search">
../images/magnifiying-glass.jpg
<input type="submit" name="Submit" value="Search">
</a>../images/pagedesign-sliced03_07.jpg
</form>
----------------------------------------------------------------------------------

Please tell me in the simplest way what i have to type into the code to get the text that was typed into the search text field.

Thankyou

domedia
09-15-2005, 03:30 PM
topics merged.
please don't cross post.

ranjan
09-15-2005, 04:23 PM
You searched for: ? -what code do i put here?
You searched for: <%=Request("Search")%>

andy106
09-15-2005, 05:07 PM
thankyou thankyou thankyou. it worked. sorry about cross posting. thankyou


woooooohooooo!!!!!