| 
<html>
 <head>
 <title>Biometrics</title>
 <style type="text/css">
 body {
 background-color:#D0D0D0
 }
 h1 {
 font-family:times new roman;
 font-size:24pt;
 font-weight:bold;
 font-style:italic;
 color:#000080
 }
 td {
 font-family:arial;
 font-size:10pt
 }
 .cat {
 font-family:arial;
 font-size:10pt;
 font-weight:bold;
 color:#000000;
 background-color:#80FFFF
 }
 .dat {
 font-family:arial;
 font-size:10pt;
 text-align:right;
 color:#000000;
 background-color:#FFFF80
 }
 .r {
 color:#FF0000
 }
 .nota {
 font-family:arial;
 font-size:10pt;
 color:#505050;
 background-color:#FFFF80;
 width:460px;
 border: 1px solid red;
 }
 </style>
 </head>
 
 <body>
 
 <h1>Body biometrics</h1>
 
 <?php if(!isset($_POST['submit']) || strlen($_POST['submit'])==0) {
 
 $CBage = "<select name='age'><option value='30'>";
 for($n=1; $n<101; $n++) { $CBage .= "<option value='$n'>$n"; }
 $CBage .= "</select>";
 ?>
 <script language="javascript" type="text/javascript">
 function isCharInList(c,list) {
 var c,list;
 if (list.indexOf(c.toLowerCase()) < 0) { return false; } else { return true; }
 }
 function isStringInList(str,list) {
 var str,list;
 for (n=0; n<str.length; n++) {
 if (!isCharInList(str.substring(n,n+1),list)) { return false; }
 }
 return true;
 }
 
 var chars = "0123456789.,";
 
 function verif() {
 
 noheight  = "Missing height";
 noweight  = "Missing weight";
 badheight = "Bad height";
 badweight = "Bad weight";
 
 if(document.data.height.value == "") {
 alert(noheight);
 document.data.height.focus();
 return false;
 }
 if(!isStringInList(document.data.height.value,chars)) {
 alert(badheight);
 document.data.height.focus();
 return false;
 }
 if(document.data.weight.value == "") {
 alert(noweight);
 document.data.weight.focus();
 return false;
 }
 if(!isStringInList(document.data.weight.value,chars)) {
 alert(badweight);
 document.data.weight.focus();
 return false;
 }
 return true;
 }
 </script>
 <form method="post" name="data" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="return verif()">
 <table border="1">
 <tr>
 <td>Sex</td>
 <td>
 <input type="radio" name="sex" value="1">Man  
 <input type="radio" name="sex" value="2">Woman
 </td>
 </tr>
 <tr>
 <td>Age</td>
 <td><?php echo $CBage; ?></td>
 </tr>
 <tr>
 <td>Activity</td>
 <td>
 <input type="radio" name="work" value="1">Worker  
 <input type="radio" name="work" value="0">Sedentary
 </td>
 </tr>
 <tr>
 <td class="r">Height (m) *</td>
 <td><input type="text" name="height" size="5"></td>
 </tr>
 <tr>
 <td class="r">Weight (kg) *</td>
 <td><input type="text" name="weight" size="5"></td>
 </tr>
 </table>
 <input type="submit" name="submit" value="Calculate">
 </form>
 
 <div class="nota">
 <b> NOTA</b>:<br/>
  Decimal separator can be either a dot or a comma<br/>
  Red with asterisk : must be provided<br/>
  If the sex isn't provided, you're supposed to be a man<br/>
  If the age isn't provided, you are supposed to be 30 years old<br/>
  If the activity isn't provided you're are supposed to be worker<br/>
 </div>
 
 <?php } else {
 include_once("texts.en.php");
 require("class.biometrics.php5.php");
 
 // 26/01/2008. Yiannis VAVOURANAKIS:
 // Normally, we choose the data and create an array like so:
 // $data = array(    'weight' => isset($_POST['weight']) ? $_POST['weight'] : "",
 //            'height' => isset($_POST['height']) ? $_POST['height'] : "",
 //            'age'    => isset($_POST['age'])    ? $_POST['age']    : "",
 //            'sex'    => isset($_POST['height']) ? $_POST['sex']    : "",
 //            'work'   => isset($_POST['work'])   ? $_POST['work']   : "",
 //            'nbdec'  => 4);
 //
 // However, since this form only contains the necessary data, we go with the $_POST array.
 // Please note that in a production environment, the form data should undergo SOME
 // validation and not be used directly, as in this example.
 
 $body = new biometrics($_POST);
 ?>
 
 <table border="1">
 <tr>
 <td colspan="2" class="cat">Data</td>
 </tr>
 <tr>
 <td>Sex</td>
 <td class="dat"><?php echo $body->getSex(); ?></td>
 </tr>
 <tr>
 <td>Age</td>
 <td class="dat"><?php echo $body->getAge()." yo"; ?></td>
 </tr>
 <tr>
 <td>Activity</td>
 <td class="dat"><?php echo $body->getWork(); ?></td>
 </tr>
 <tr>
 <td>Height</td>
 <td class="dat"><?php echo $body->getHeight()." cm"; ?></td>
 </tr>
 <tr>
 <td>Weight</td>
 <td class="dat"><?php echo $body->getWeight()." kg"; ?></td>
 </tr>
 <tr>
 <td colspan="2" class="cat">BMI: Body Mass Index</td>
 </tr>
 <tr>
 <td>Body Mass Index</td>
 <td class="dat"><?php echo $body->bmi(); ?></td>
 </tr>
 <tr>
 <td>BMI level</td>
 <td class="dat"><?php echo $body->evalbmi(); ?></td>
 </tr>
 <tr>
 <td>BMI diagnostic</td>
 <td class="dat"><?php echo $body->bmistatus(); ?></td>
 </tr>
 <tr>
 <td>Correct weight</td>
 <td class="dat"><?php echo "between ".$body->llimit()." and ".$body->hlimit()." kg"; ?></td>
 </tr>
 <tr>
 <td colspan="2" class="cat">IBW: Ideal Body Weight</td>
 </tr>
 <tr>
 <td>Formula of Devine (1974)</td>
 <td class="dat"><?php echo $body->devine()." kg"; ?></td>
 </tr>
 <tr>
 <td>Formula of Lorentz (1929)</td>
 <td class="dat"><?php echo $body->lorentz()." kg"; ?></td>
 </tr>
 <tr>
 <td>Formula of Lorentz (accounting of age)</td>
 <td class="dat"><?php echo $body->lorentza()." kg"; ?></td>
 </tr>
 <tr>
 <td>Formula of Peck's</td>
 <td class="dat"><?php echo $body->pecks()." kg"; ?></td>
 </tr>
 <tr>
 <td colspan="2" class="cat">LBM: Lean Body Mass</td>
 </tr>
 <tr>
 <td>Formula of Hume (1966)</td>
 <td class="dat"><?php echo $body->hume_lbm()." kg"; ?></td>
 </tr>
 <tr>
 <td>Formula of James (1981)</td>
 <td class="dat"><?php echo $body->james()." kg"; ?></td>
 </tr>
 <tr>
 <td colspan="2" class="cat">CTW: Calculation of Total Water</td>
 </tr>
 <tr>
 <td>Formula of Hume</td>
 <td class="dat"><?php echo $body->hume_ctw()." kg"; ?></td>
 </tr>
 <tr>
 <td>Formula of Watson</td>
 <td class="dat"><?php echo $body->watson()." kg"; ?></td>
 </tr>
 <tr>
 <td colspan="2" class="cat">BSA: Body Surface Area</td>
 </tr>
 <tr>
 <td>Formula of Boyd (most precise)</td>
 <td class="dat"><?php echo $body->boyd()." mē"; ?></td>
 </tr>
 <tr>
 <td>Formula of Dubois and Dubois (1916)</td>
 <td class="dat"><?php echo $body->dubois()." mē"; ?></td>
 </tr>
 <tr>
 <td>Formula of Dubois and Dubois, other formula</td>
 <td class="dat"><?php echo $body->dubois2()." mē"; ?></td>
 </tr>
 <tr>
 <td>Formula of Gehan and George (1970)</td>
 <td class="dat"><?php echo $body->gehan()." mē"; ?></td>
 </tr>
 <tr>
 <td>Formula of Haycock (1978)</td>
 <td class="dat"><?php echo $body->haycock()." mē"; ?></td>
 </tr>
 <tr>
 <td>Formula of Mosteller (1987)</td>
 <td class="dat"><?php echo $body->mosteller()." mē"; ?></td>
 </tr>
 <tr>
 <td colspan="2" class="cat">EER: Energy Expense at Rest</td>
 </tr>
 <tr>
 <td>Formula of Black and al (1996)</td>
 <td class="dat"><?php echo $body->black()." Kcal"; ?></td>
 </tr>
 <tr>
 <td>Formula of Harris and Benedict (1919)</td>
 <td class="dat"><?php echo $body->harris()." Kcal"; ?></td>
 </tr>
 <tr>
 <td>Formula of Harris and Benedict recalculated by Roza and Shizgal (1994)</td>
 <td class="dat"><?php echo $body->harrisrs()." Kcal"; ?></td>
 </tr>
 <tr>
 <td colspan="2" class="cat">DEN: Daily Energy Need</td>
 </tr>
 <tr>
 <td>Dayly Energy Need based on the formula of Black and al</td>
 <td class="dat"><?php echo $body->enerneed(). " Kcal"; ?></td>
 </tr>
 </table>
 
 <?php } ?>
 </body>
 
 </html>
 
 |