Complex PHP/JavaScript calculator with MySQL backend

The other day I was coding an interesting project via Upwork for a guy in US. The point of calculator was to provide the visitor information about what would be the most cost efficient way to eat when visiting Disney World. I have personally not been to Disney World before, but looks like you can choose between predefined dining plans or buying each meal separately.

There are number of restaurants withing the park (close to 180) in different areas. Restaurants provide different service methods (quick service, table service or just a snack) and have different pricing, some are cheap, other expensive. Visitor can further choose between several extra options for drinks and deserts.

Anyway, what makes the calculator special and complex is the fact, that there are number of variables included. All the data in stored in MySQL database, while calculations are done on the fly with JavaScript and PHP/Ajax data retrieval from db. On each select a JavaScript function is initialized, which fills the next select, calculates all the data, etc. Quite interesting… One of the main features to point out is also the form, which is dynamically build when it comes to number of day staying. When selecting the number of days, form controls are added or removed from existing. Very neat feature.

The user stays on the same page from the beginning to the end due to Ajax usage. This way calculator can be easy integrated into any web page as iFrame or in any other way when running on WordPress and other frameworks.

You can find a live version of calculator here: https://disneyworld.rešitve.si/

Play around and see how it works.