Location: PHPKode > scripts > Biometrics Class > biometrics-class/biomdemo.en.php
<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>

<? if(!$submit) {

$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() {

	nosize    = "Missing height";
	noweight  = "Missing weight";
	badsize   = "Bad height";
	badweight = "Bad weight";

	if(document.data.size.value == "") {
		alert(nosize);
		document.data.size.focus();
		return false;
	}
	if(!isStringInList(document.data.size.value,chars)) {
		alert(badsize);
		document.data.size.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="<? echo $PHP_SELF; ?>" onsubmit="return verif()">
<table border="1">
<tr>
	<td>Sex</td>
	<td>
		<input type="radio" name="sex" value="1">Man &nbsp;
		<input type="radio" name="sex" value="2">Woman
	</td>
</tr>
<tr>
	<td>Age</td>
	<td><? echo $CBage; ?></td>
</tr>
<tr>
	<td>Activity</td>
	<td>
		<input type="radio" name="work" value="1">Worker &nbsp;
		<input type="radio" name="work" value="0">Sedentary
	</td>
</tr>
<tr>
	<td class="r">Height (m) *</td>
	<td><input type="text" name="size" 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>&nbsp;NOTA</b>:<br/>
&nbsp;Decimal separator can be either a dot or a comma<br/>
&nbsp;Red with asterisk : must be provided<br/>
&nbsp;If the sex isn't provided, you're supposed to be a man<br/>
&nbsp;If the age isn't provided, you are supposed to be 30 years old<br/>
&nbsp;If the activity isn't provided you're are supposed to be worker<br/>
</div>

<? } else {
require("class.biometrics.php");
$body = new biometrics($weight,$size);
?>

<table border="1">
<tr>
	<td colspan="2" class="cat">Data</td>
</tr>
<tr>
	<td>Sex</td>
	<td class="dat"><? echo $body->t_sex[$body->sex]; ?></td>
</tr>
<tr>
	<td>Age</td>
	<td class="dat"><? echo $body->age." yo"; ?></td>
</tr>
<tr>
	<td>Activity</td>
	<td class="dat"><? echo $body->t_work[$body->work]; ?></td>
</tr>
<tr>
	<td>Height</td>
	<td class="dat"><? echo $body->size." cm"; ?></td>
</tr>
<tr>
	<td>Weight</td>
	<td class="dat"><? echo $body->weight." kg"; ?></td>
</tr>
<tr>
	<td colspan="2" class="cat">BMI: Body Mass Index</td>
</tr>
<tr>
	<td>Body Mass Index</td>
	<td class="dat"><? echo $body->bmi; ?></td>
</tr>
<tr>
	<td>BMI level</td>
	<td class="dat"><? echo $body->bmilevel; ?></td>
</tr>
<tr>
	<td>BMI diagnostic</td>
	<td class="dat"><? echo $body->bmistatus; ?></td>
</tr>
<tr>
	<td>Correct weight</td>
	<td class="dat"><? 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"><? echo $body->devine." kg"; ?></td>
</tr>
<tr>
	<td>Formula of Lorentz (1929)</td>
	<td class="dat"><? echo $body->lorentz." kg"; ?></td>
</tr>
<tr>
	<td>Formula of Lorentz (accounting of age)</td>
	<td class="dat"><? echo $body->lorentza." kg"; ?></td>
</tr>
<tr>
	<td>Formula of Peck's</td>
	<td class="dat"><? 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"><? echo $body->hume_lbm." kg"; ?></td>
</tr>
<tr>
	<td>Formula of James (1981)</td>
	<td class="dat"><? 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"><? echo $body->hume_ctw." kg"; ?></td>
</tr>
<tr>
	<td>Formula of Watson</td>
	<td class="dat"><? 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"><? echo $body->boyd." m²"; ?></td>
</tr>
<tr>
	<td>Formula of Dubois and Dubois (1916)</td>
	<td class="dat"><? echo $body->dubois." m²"; ?></td>
</tr>
<tr>
	<td>Formula of Dubois and Dubois, other formula</td>
	<td class="dat"><? echo $body->dubois2." m²"; ?></td>
</tr>
<tr>
	<td>Formula of Gehan and George (1970)</td>
	<td class="dat"><? echo $body->gehan." m²"; ?></td>
</tr>
<tr>
	<td>Formula of Haycock (1978)</td>
	<td class="dat"><? echo $body->haycock." m²"; ?></td>
</tr>
<tr>
	<td>Formula of Mosteller (1987)</td>
	<td class="dat"><? 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"><? echo $body->black." Kcal"; ?></td>
</tr>
<tr>
	<td>Formula of Harris and Benedict (1919)</td>
	<td class="dat"><? echo $body->harris." Kcal"; ?></td>
</tr>
<tr>
	<td>Formula of Harris and Benedict recalculated by Roza and Shizgal (1994)</td>
	<td class="dat"><? 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"><? echo $body->enerneed. " Kcal"; ?></td>
</tr>
</table>

<? } ?>
</body>

</html>
Return current item: Biometrics Class