<?php
mysql_connect ("localhost", "root","password") or die (mysql_error());
mysql_select_db ("postcode");
$term = $_POST['term'];
if ($sql = mysql_query("SELECT * FROM uk_postcodes, zones WHERE postcode LIKE '%$term%' AND zone_id = zone_large ")) {
if (mysql_num_rows($sql)) {
while ($row = mysql_fetch_array($sql)){
echo '<br/> Postcode: '.$row['postcode'];
echo '<br/> Town: '.$row['town'];
echo '<br/> County: '.$row['county'];
echo '<br/> Small: £'.$row['price_s'];
echo '<br/> Medium: £'.$row['price_m'];
echo '<br/> Large: £'.$row['price_l'];
echo '<br/><br/>';
}
} else {
echo "please contact us for price";
}
}
?>