I need help on database entry search.
I am developing an inventory system. And I want a user to be able to search based on words/keywords that they will input in a textbox.
Could anybody give suggestions? Thanks in advance.
backups2007,
The lowtech solution is to have a form which allows the user to search the inventory, post the information to a search results page. This page tests the information from the form and then, if it's good executes a search on the database displaying any selected results.
The Form
[html]
<form id="searchForm" action="searchresults.php" method="post">
<input type="text" size="20" id ="searchText"name="searchText"/>
<input type="submit" id="SearchButton" value="Search" />
</form>
[/html]
The PHP
[php]
<?php
// test the data
if(!empty($_POST['searchText']))
{
// search the database
}
[/php]
This should give you a starting point, I do not know your data structure so you'll have to put in the SQL. But then it's a case of echoing out the results or displaying a message saying there are no matches.
Cheers
nathj