Back | Reverse | Quick Reply | Post Reply |

Search bar, how do you code it?
Link | by Kit on 2006-08-01 08:00:08
Okay... Now i have a pretty stupid question here. How do you code a search bar using php codes? >_> I know I am pretty much an idiot but please, I really need help here! Thanks.

Loneliness have always been my friend...

Until the day I find you...


Re: Search bar, how do you code it?
Link | by gendou on 2006-08-01 10:11:25
To add a search feature to your page:

1. Create an HTML <form> (POST method) with one text input for typing the search parameter (lets call it 'query'), and a button to submit the form.
2. Use the PHP variable $_POST['query'] for your search.


Re: Search bar, how do you code it?
Link | by Kit on 2006-08-01 18:51:15
Okay.... I am a complete newbie on php.

So I have create a form but the problem is I can't get it to search every table(I am using mysql) I have for the query. What should I do?

Loneliness have always been my friend...

Until the day I find you...


Re: Search bar, how do you code it?
Link | by gendou on 2006-08-01 20:08:29
you might do a query like this after storing mysql_escape_string($_POST['query']) into $query:
SELECT *
FROM MyTable
WHERE columnName LIKE '%$query%'



Re: Search bar, how do you code it?
Link | by Kit on 2006-08-01 23:30:04
Okay... I will try. Thanks!! ^^

Loneliness have always been my friend...

Until the day I find you...


Re: Search bar, how do you code it?
Link | by gendou on 2006-08-01 23:37:39
as problems arise, as i am sure they will, keep posting here for help if you need it!


Back | Reverse | Quick Reply | Post Reply |

Copyright 2000-2024 Gendou | Terms of Use | Page loaded in 0.0029 seconds at 2024-05-05 19:22:54