Page 1 of 1

How to Create a Simple Search Function on my page

Posted: Wed Jan 07, 2009 10:48 am
by TGP
Hello, I'm looking to input a simple php script on all pages of my website that allows the user to search the entire site for a product.

I'm after something like this: Image

Any help greatly appreciated

Re: How to Create a Simple Search Function on my page

Posted: Wed Jan 07, 2009 10:52 am
by mattpointblank
Is your content (products) stored in a database? If so, it should be fairly simple to write a script that takes user input (the search terms), cleans them up, and runs a SQL query against the database to find similar records.

If your content isn't in a database, this will be quite a bit harder. An easier option might be incorporating one of Google's free site search tools you can add.

Re: How to Create a Simple Search Function on my page

Posted: Wed Jan 07, 2009 10:55 am
by andyhoneycutt
If you're looking for a very quick solution, you can always provide a google search feature on your website. If you're looking for a custom solution, you'll need to have a database back-end holding the data you wish to search. You'll need to write a script that will take the user's input and apply it to a sql query to help them find the results they wish to see.

-Andy

Edit: Wow, i'm slow.

Re: How to Create a Simple Search Function on my page

Posted: Wed Jan 07, 2009 1:46 pm
by TGP
Oh ok thanks, erm no I don't have a database with the products on, could anyone give me an idea on how to do this and then code the search function to look through it like you mentioned.

Re: How to Create a Simple Search Function on my page

Posted: Thu Jan 08, 2009 3:08 am
by mattpointblank