/path/to/webroot/properties/geo_search.php
with the following content:<?php /** * File: /path/to/webroot/properties/geo_search.php */ include('init.php'), // Get the data from form (if submitted) $latitude = !empty($_POST['latitude']) ? $_POST['latitude'] : ''; $longitude = !empty($_POST['longitude']) ? $_POST['longitude'] : ''; $radius = !empty($_POST['radius']) ? $_POST['radius'] : 5; // Set the variables for view $viewVars['latitude'] = $latitude; $viewVars['longitude'] = $longitude; $viewVars['radius'] = $radius; render('geo_search'),
/path/to/webroot/properties/views/geo_search.thtml:
<!-- File: /path/to/webroot/properties/views/geo_search.thtml --> <form action="geo_search.php" method="post"> <fieldset> <legend>Geo Location Search</legend> <div class="input"> <label>Latitude: </label> <input type="text" name="latitude" value="<?php echo $viewVars['latitude']; ?>" /> </div> <div class="input"> <label>Longitude: </label> <input type="text" name="longitude" value="<?php echo $viewVars['longitude']; ?>" /> </div> <div class="input"> <label>Within: </label> <select name="radius"> <?php for ($i = 5; $i <= 30; $i += 5): ?> <?php $selected = ''; if ($i == $viewVars['radius']) { $selected = ' selected'; } ?> <option value="<?php echo $i; ?>" <?php echo $selected; ?>> <?php echo "$i Kms"; ?> </option> <?php endfor; ?> </select> </div> <div class="input"> <label> </label> <input type="submit" name="submit" value="Search" /> </div> </fieldset> </form>