I am seeking help to create a html search form that has a drop down box listing tables within a mysql database that contain parts for different makes of buses.
The idea is that the drop down list would select the table and the part would be found within the selected table by keyword description or part number with a text box.
The table catagories and contents can be seen here. http://www.jimsbusparts.com
A working simple search without the drop down can be seen here. http://www.jimsbusparts.com/search1.html
My html is;
<form action="results.php" method="post">
<p>
<select name="select" id="select">
<option>MCI</option>
<option>GM</option>
<option>Engines</option>
</select>
</p>
<p>Part Name:
<input type="text" name="term" />
<br />
<input type="submit" name="submit" value="Submit" />
</p>
</form>
My php code so far is;
mysql_select_db("xxxxxxx", $con);
$term = $_POST['term'];
$sql = mysql_query("select * from MCI where Description like '%$term%'");
while ($row = mysql_fetch_array($sql))
{
echo 'ID: '.$row['ID'];
echo '<br/> Part No: '.$row['Part No'];
echo '<br/> Description: '.$row['Description'];
echo '<br/> Price: '.$row['Price'];
echo '<br/><br/>';
}
?>
I realize that there is more involved regarding form validation and security but I am having trouble wrapping my mind around php coding. If someone could first help me get the basic search working step by step and then add the refinements after I think I might be able to grasp it.
I would be most grateful.