I want to create a feature as you see in this image, where it says 'filter your results' if a user clicks 'Detached Houses' then only detached houses will be displayed. if a user clicks 'Semi-detached' then only semi detached houses will be shown. all the data would be shown from a MYSQL database which has already been set up.
Any help is really appreciated, thank you.
Heres the code I have so far:
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div id="filter"><p class="houses" style="font-family:helvetica;color:#0155a1;font-size:14px;background:url(cutouts/forsale/filter.jpg) no-repeat;"><b><u>Houses</u></b>
<br />
<a href="www.mumtazproperties.hostei.com/show_houses.php?type=detached"><span class="dh"><b><u>Detached Houses</u></b></span></a>
<?php
// Make a MySQL Connection
mysql_connect("mysql10.**********.com", "a2221438_usman", "usman1") or die(mysql_error());
mysql_select_db("a2221438_homes") or die(mysql_error());
// Get a specific result from the "example" table
$result = mysql_query("SELECT * FROM example
WHERE name='Sandy Smith'") or die(mysql_error());
$query = "SELECT * FROM example";
if(isset($_GET['type']))
{
$query .= " WHERE type = '" . mysql_real_escape_string($_GET['type']) . "'";
}
// get the first (and hopefully only) entry from the result
$row = mysql_fetch_array( $result );
// Print out the contents of each row into a table
echo $row['name']." - ".$row['age'];
?>
<br />
<span class="dh"><b><u>Semi-detached houses</u></b></span>
<br />
<span class="dh"><b><u>Terraced houses</u></b></span>
<br />
<br />
<b><u>Flats / Apartments</u></b>
</p></div></td>