NYCPHP Meetup

NYPHP.org

[nycphp-talk] Form frustrations

Leam Hall leamhall at gmail.com
Mon May 28 10:25:27 EDT 2012


Morning all!

I'm trying to get past two of my many programming hurdles and would 
appreciate your help. Pointers to documentation are fine, my goal is to 
learn, not just get the question answered.

I'm writing a small application to plan scuba dives. The planning takes 
in lots of user input and checks it against safety margins, recommends 
gas requirements based on time, etc.

There are two topics I'm working on and three issues within those 
topics. First, I'm trying to build my Object skills so am using an 
object and some methods. The other topics, and two issues are on forms. 
I prefer to stay with straight PHP while I learn, before going to a 
Forms tool or framework. So I'm thing to set things up so that a user 
could do a quick query or a full dive profile using the same object and 
methods.

Here are some use cases, hopefully they make sense.

You want to dive to 114 feet to see a certain wreck. What's the best 
Nitrox mix for a 1.6 PPO2 at 114? What's the mix for 1.4 PPO2?

You just want to go dive and your tanks have 36% in them. What's the MOD?

You and a buddy want to go to 65 feet FFW and penetrate 500' into 
Jackson Blue. What are your gas requirements individually and for 
matching to meet the rule of thirds? What mixes can you use?

You expect to need 27 minutes on task at 130 feet to survey the first 
part of the wreck. What mix can you use, how much deco gas will you 
need, and where's your CNS clock at the end?


 From a PHP perspective the math is pretty simple. What I am less 
skilled at is designing the form flow and logic to retain inputs while 
error checking and incrementally entering form data. For example, you 
can't compute gas used without SAC, ATA, and Time.

A simple, non-functional view is at: 
http://reuel.net/dive/demo_dive_planner.php

What I would like to have is a form that lets them compute parts of the 
dive or all of it, depending on what option they pick and what data they 
fill in. That is:

Fill in Depth and click "Compute ATA". Which is doable.
Fill in Depth, Time, and SAC and click "Gas Required". Which is doable. 
If you forget one return the form with the data you already provided and 
error mark the parts you forgot.

Make sense?

Leam



More information about the talk mailing list