Copy link to clipboard
Copied
HELP! I have given up figuring this out on my own and need an expert to point me in the right direction.
I have tried and tried to make a site search and the only one I can get to work is the one I "creatively borrowed" on the web. It is a google type search that has ads. I want something that is ad free and simple. Can anyone please help. I have php enabled on my server. I just want the box and the magifying glass icon only. Then when a user types in their keywords, it brings the results into a seperate page.
Thank you! Donna
Is this a dynamic or static site you are talking about?
If a dynamic site, you can often allow users to search by querying the database that the dynamic content is stored in. If it's static, then you need to either build or buy an engine. This will crawl your site and build an index in a database. The database links the pages in your site to search terms.
Obviously we can't really help without knowing more about your site and your capabilities.
You might want to check out something like Zoom - http
...Copy link to clipboard
Copied
Content is stored in database. Create a form with method="GET" action results.php and input type="text" id="search_term".
On results.php declare the variable for the form value "search_term"
$search_term = $_GET['search_term'];
Then create a query to select whatever form your database table where the table field is LIKE the submitted search term.
SELECT * FROM table WHERE field1 LIKE ‘%$search_term%’
do { } while to loop the query results where query rows => 1 else show message that no search results were returned. Sanitize variables to prevent injection attack on your database.
Ironically, there is plenty of information on the subject if you search google for the term: php search form tutorial.
Copy link to clipboard
Copied
Dear Shocker,
You obviously know a great deal about forms, but I am such a newbie! Can you please help me? I want my search results to look like this: http://www.indianabankers.org/searchsite.cfm?searchvalue=banking
Here is my "search form" code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search ABA</title>
</head>
<body>
<form action="searchresults.php" method="get" type="text" id="search_term"></form>
</body>
</html>
I need to have a simple keyword search results page that searches the site: www.arkbankers.org
Can you tell me what code I would need in my search results page? By the way, I do have php enabled on my server.
THANKS!!!!!!!!!!!!!!!!!!!! Donna
Copy link to clipboard
Copied
Ugh..I pasted the wrong code. Here is my search form: It can be found at www.arkbankers.org/search.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search ABA</title>
</head>
<body>
<form name="searchsite" method="get" action="arkbankers.org/searchresults.html" target="_top">
<strong>Site Search<strong><br />
<input type="text" size="25" name="searchvalue"> <input type="submit" name="submit" value=" Search "><br />
</strong></strong>
</form>
</body>
</html>
Copy link to clipboard
Copied
Is this a dynamic or static site you are talking about?
If a dynamic site, you can often allow users to search by querying the database that the dynamic content is stored in. If it's static, then you need to either build or buy an engine. This will crawl your site and build an index in a database. The database links the pages in your site to search terms.
Obviously we can't really help without knowing more about your site and your capabilities.
You might want to check out something like Zoom - http://www.wrensoft.com/zoom/ and see if that meets your needs.
Copy link to clipboard
Copied
It is a static site. I do have php enabled on my server. Currently I do have an order form using php that works well. This is the only other form I will have IF I can ever figure it out.
Thanks for your help. Any other advice is appreciated!
Donna
Copy link to clipboard
Copied
Like I said in the first response and has been echoed by bregent: you need your content to be stored in the database to search it. For a static site the best you can do is use a service that indexes your page and provides a search based off their index results. Downside is it may take some time for the service to index new content when you post it. So new(er) content might not be available in serch results immediately. Alternatively you could use spry filtering to filter keyword results from a dataset. If you have repeating elements in html content then you may be able to create a dataset from the static content.
View source:
http://labs.adobe.com/technologies/spry/samples/data_region/SuggestSample.html
The ideal method is to enter your pages content into the database and use a filtered recordet to display the page's content on the page based off a URL parameter. Example site.com/index.php?page=home will show content for home page, site.com/index.php?page=about will show content for about page, etc. That way you only have one file for all of your pages and the content of the page is based on the filtered URL parameter for the recordset. Then, for user-simplicity, use .htaccess mod_rewrite to rewrite URL from site.com/index.php?page=something to site.com/something.html After that use the method I described earlier to set form action to results.php where a query is run based off search term in URL parameter and results are displayed based off the results of the query.
Copy link to clipboard
Copied
Bravo! Thanks so much for your post. I was able to download the free version of the program for testing and have it working in a test page in less
than an hour. I am so relieved. Now I can move on to finishing the new site.
I am not a programmer and really didn't want to learn something that is not in my realm of expertise. I leave that to those who do. The Zoom search engine I downloaded from http://www.wrensoft.com/index.html worked perfect for my application.
Thanks and Happy New Year!
Donna