laflair13 — 2012-04-25T16:38:15-04:00 — #1
I have searched google but cannot find a good source for this.
I want to add a search box on a website that searches the database and puts the results on a page like results.php or something.
Can anyone lead me in the right direction? Sites made with php and mysql
guido2004 — 2012-04-26T04:36:53-04:00 — #2
Are you sure googling something like this doesn't give you any good source to start working with?
boatmark — 2012-04-26T21:53:10-04:00 — #3
Just catch user input in search field and past it in mysql query... Oh, no, better use PDO for this. And dont forget to verify this input.
ralphm — 2012-04-26T22:30:10-04:00 — #4
As a side note, I never find that these work very well. Even though it's not as pretty, I prefer to put a Google search form on my sites. You get much more thorough results. E.g.
<form method="get" action="http://www.google.com/search">
<label for="q">Search this Site</label>
<input type="text" class="text" name="q" id="q" size="31" maxlength="255" value="">
<input class="submit" type="submit" value="Search">
<input type="hidden" name="sitesearch" value="<font color='"#FF0000"'>mysite.com</font>">
(Make sure to put your own domain in place of mysite.com.)