Muddy_Funster Posted December 28, 2012 Share Posted December 28, 2012 your text filed is missing a bunch of attributes, so is your form. try this: <form name="townFilter" id="townFilter" method="post" action="viewall.php"> Town <input type="text" name="townInput" value="" /> <input type="submit" name="townsearch" value="Search" /> </form> This will let you access the $_POST superglobal array when you get to the viewall.php page. superglobal arrays are special arrays in PHP, the main ones are $_POST, $_GET, $_SERVER and $_SESSION $_POST and $_GET deal with form data (and url data in the case of $_GET) and are key to interacting with users through forms. to access the arrays you need to do several things, set the method that the form uses to send the data using method="post" / method="get" name the form elements (you should really be doing this anyway as a best-practice) set up some code on the target .php page to check for and use the form data when it gets there. read up on $_POST at the php.net/manual site Quote Link to comment https://forums.phpfreaks.com/topic/272445-return-results-from-a-mysql-database-dependent-on-town-entered/page/2/#findComment-1401843 Share on other sites More sharing options...
ianhaney Posted December 28, 2012 Author Share Posted December 28, 2012 Thank you I am going to have to look again at this as not 100% on getting the results displayed from the user input Quote Link to comment https://forums.phpfreaks.com/topic/272445-return-results-from-a-mysql-database-dependent-on-town-entered/page/2/#findComment-1401845 Share on other sites More sharing options...
Barand Posted December 28, 2012 Share Posted December 28, 2012 If you can get the latitude and longitude of each place, or the OS easting and northing, then you can calculate the distances. OS cordinates are easiest as they are in metres. Otherwise if your displacements aren't too great (less than a few kilometers) and you're not right at the poles, use the quick and dirty estimate that 111,111 meters in the y direction is 1 degree (of latitude) and 111,111 * cos(latitude) meters in the x direction is 1 degree (of longitude). Quote Link to comment https://forums.phpfreaks.com/topic/272445-return-results-from-a-mysql-database-dependent-on-town-entered/page/2/#findComment-1401917 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.