Hi...
I have connected to a MySQL database that contains information on various companies. I have created a HTML form with 4 drop down list boxes that have static information to (hopefully) search the database including company size, location, sector, etc. The user will select items from the drop down list boxes and click go to retrieve the required data.
For example, a user may want to search for all medium sized companies in Leicester in the IT sector. The code I have so far is as follows;
mysql_select_db("beacon",$db);
$result = mysql_query("SELECT name, County, sector, company_size FROM beacon",$db);
echo "<table border=1 align=center>\n";
echo "<tr><td>Name</td><td>County</td><td>Sector</td><td>Company Size</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[0], $myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
Which displays all the records from the database. An example of the Drop Down List HTML Code is as follows;
<select name="company_size">
<option selected>Select Company Size</option>
<option>1 - 9</option>
<option>10 - 49</option>
<option>50 - 250</option>
</select>
I cannot work out how the SQL to say SELECT records WHERE = to selected drop down list items.
Any help would be really appreciated.