with the "free" limited (2800 ish records) According to the list from GVolt (I think) I am only missing about 200... not many..
<?php
include("db.php");
?>
<html>
<head>
<title>Show Close Postcode Areas</title>
</head>
<body>
<form name="postcode" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Input Postcode (M33 etc only) <input type="text" name="pcode" value="<?php echo $_POST['pcode'];?>"><br />
Input distance <input type="text" name="dist" value="<?php echo $_POST['dist'];?>"><br />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
<?
if (isset($_POST['submit']))
{
$pcode = $_POST['pcode'];
$dist = $_POST['dist'];
$query=do_query("SELECT lat,lon FROM postcodes WHERE postcode='".$pcode."'");
list($lat,$long)=mysql_fetch_row($query);
$query=do_query("SELECT postcode,lat,lon FROM postcodes WHERE postcode!='".$pcode."'");
while(list($pcode2,$lat2,$long2)=mysql_fetch_row($query))
{
if (3963.0*acos(sin($lat/57.2958)*sin($lat2/57.2958)+cos($lat/57.2958)*cos($lat2/57.2958)*cos(($long2/57.2958)-($long/57.2958)))<=$dist)
{
echo $pcode2." is close<br />";
}
}
}
?>