I currently have this code which saves all the information to the database but I want to be able to allow users to search using their postcode so only results within the radius they select is shown eg. 1mile, 2mile etc I am not sure how to go about doing this.
<form action="addhobby.php" method="POST">
Type:<input type="radio" name="type" value="meetup" checked>Meetup
<input type="radio" name="type" value="chat" checked>Chat
<br />
Hobby:<input type="text" name="hobby" value=""><br />
Location:<input type="text" name="location" value=""><br />
Postcode:<input type="text" name="postcode"><br />
Starts: <input type="date" name="startdate"> <input type="time" name="starttime"><br />
Ends: <input type="date" name="enddate"> <input type="time" name="endtime"> <br />
Description: <input type="text" name="description"><br />
<input type="submit" name="submit" value="Create">
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
$sql="INSERT INTO activities (hobby, location, postcode, sdate, stime, edate, etime, description, type) VALUES
('$_POST[hobby]','$_POST[location]', '$_POST[postcode]', '$_POST[startdate]', '$_POST[starttime]', '$_POST[enddate]', '$_POST[endtime]', '$_POST[description]', '$_POST[type]' )";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header("location:profile.php");
mysql_close($con)
?>