ARV187 Posted March 17, 2019 Report Share Posted March 17, 2019 I would like to add an option to allow you to search for a flight that has for example between 200 miles and 300 miles something similar to: search flight where 'distance' between "$distance1" and "$distance2" I have scanned these files: schedule_searchform.tpl core/modules/Schedules/schedules.php but I can not find out what code I need to do this. Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted March 17, 2019 Administrators Report Share Posted March 17, 2019 What version of phpVMS? Does your schedule search already show an option for greater than/less than? If so, look in /core/common/SchedulesData.class.php around line 322 for distanceBetweenPoints function. This will give an idea how that function works and help you write a new function to do exactly what you want. You would also need to add to /core/templates/schedule_searchform.php so the pilot has the option to search by a distance range. Quote Link to comment Share on other sites More sharing options...
ARV187 Posted March 17, 2019 Author Report Share Posted March 17, 2019 (edited) v2.1.936 version, I saw that function, but I don't figure that do with that, the function calculate the distance between two points. I can do that in phpmyadmin with a sql sentence, but I do not know how to move it to that in schedule_searchform distances section with the existing form, where the data of the query "between" are those that the user enters in two fields type number. <div id="distance"> <p>Selecciona distancia:</p> <select id="type" name="type"> <option value="greater">Greater than</option> <option value="less">Less than</option> </select> <input type="text" name="distance" value="" /> <input type="submit" name="submit" value="Search flight" /> <br /><br /> <option value="between">Between</option> <?php $sql = "SELECT * FROM `phpvms_schedules` WHERE `distance` BETWEEN $distance1 AND $distance2"; ?> <input type="number" name="distance1" min="1" max="9999" value="" /> > <input type="number" name="distance2" min="1" max="9999" value="" /> <input type="submit" name="submit" value="Search flight" /> </div> Edited March 17, 2019 by ARV187 Quote Link to comment 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.