impress(); //debugInfo($_POST, "\$_POST", __LINE__, __FILE__); $isSalt = true; $errorMsg = ''; $msg = ''; $boat =& new Boat(); /* $boatTable =& new DBTable("boat"); if(isset($GLOBALS["errMsg"])){ echo "Error: at line ".__LINE__.$GLOBALS["errMsg"]; exit; } */ /* * Calculate button was pressed */ if(isset($_POST['action']) and $_POST['action'] == "calculate"){ /* * Read in posted variables */ $boat->setLwl(convertToDecimalFeet($_POST['lwlFt'], $_POST['lwlIn'])); $boat->setLoa(convertToDecimalFeet($_POST['loaFt'], $_POST['loaIn'])); $boat->setBeam(convertToDecimalFeet($_POST['beamFt'], $_POST['beamIn'])); $boat->setBeamWL(convertToDecimalFeet($_POST['beamWLFt'], $_POST['beamWLIn'])); $boat->setDisplacement($_POST["displacement"]); $boat->setBallast($_POST["ballast"]); $boat->setSailArea($_POST["sailArea"]); /* do calculations */ $boat->completeCalculations($boat, $isSalt); } /* display page */ include($viewTemplate); function convertToDecimalFeet($feet, $inches){ $feet = round($feet); $inches = round($inches); return ($feet + round($inches/12*100)/100); } ?>