Click to See Complete Forum and Search --> : searching facility
Cassius
01-31-2005, 09:05 AM
i would like to create a search box on my website, where a user would type a word in this box (e.g. animals), and if i have a page animals.php, it will load that page, else it will return a general not found page. I have never worked with anything similar before, so any tips, from where i could start/read, how to implement such a feature would be greatly appreciated.
Thank You
soccer362001
01-31-2005, 09:32 AM
You would need to use some sort of server side language. Those include but are not limited to PHP, ASP, JSP, CGI, PERL.
Cassius
01-31-2005, 09:45 AM
thank you. i was aware that i need to use some kind of server-side languages. However, if anyone has any links to articles/tutorials regarding this topic, i would greatly appreciate it.
The reason is, that everytime, i am trying to search on google for such tutorials, i am only returning results on search engines optimisation ( maybe i am using the wrong keywords ).
Thank You
Robert Wellock
01-31-2005, 10:00 AM
http://www.isearchthenet.com/isearch/
george1234
02-01-2005, 10:26 PM
You can try Zoom: http://www.wrensoft.com/zoom/
It can also search for content/title/etc. found within pages, but its pretty configurable and I'm pretty sure you can limit it to search for filename only.
You don't need to know any scripting, since it does it for you. Just find out which language (PHP, ASP, Javascript) your web server supports.
In ASP... first, make a form with a get method. Like this.
<FORM NAME="Search" METHOD="get" ACTION="SearchResult.asp" ID="Form1">
Search Criteria: <INPUT id="Text1" type="text" name="txtCriteria" class="idtext" value="">
<INPUT id="Submit1" type="submit" value="Search" name="Search" class="button">
</FORM>
Now on SearchResults.asp add this code:
Dim Criteria
Criteria = Trim(Request.QueryString("txtCriteria"))
Criteria = Criteria & ".asp"
Response.Redirect(txtCriteria)
That will send them to the page.
Cassius
02-02-2005, 07:39 AM
thank you for that piece of asp, it does exactly, what i was looking for. However, can you tell me what's the equivalent Response.Redirect in PHP ?
Thank You
I think it may be:
(!redirect("url"))
But I'm not too sure on PHP.
Cassius
02-02-2005, 08:16 AM
thank you. Actually, as a test i have tried the following:
<html><head><title></title></head><body>
<form method="post" action="test.php">
<input type="text" name="test1">
<input type="submit"></form>
</body>
<html>
then i put the following in the test.php
<?php
$max2 = @$_POST["test1"];
$max3 = "http://www.$max2.com";
Header("Location: $max3");
?>
It seems to work fine, however, how can i edit the above code, so that in case the page does not exist, it will redirect to a particular page which i want i.e. to a not found page ?
Thank You