<?php
//enable visitors to see the PHP source code of current file
$me basename($_SERVER['PHP_SELF']);
if(isset(
$_GET['showPHP'])){
    
show_source("$me");    
    die();
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="assets/css.css" type="text/css" rel="stylesheet"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<?php 
include("includes/header.inc.php");
?>

<!--This meta element defines a description of my page:-->
<meta name="description" content="BMI, body mass index" /> 

<!--This meta element defines searched keywords:-->
<meta name="keywords" content="BMI, body, mass, index, Jonas, Grolin, sleekram@gmail.com" /> 
<title>BMI</title>
</head>
<body>
<div id="wrapper">
<?php 
include("includes/top-navigation.inc.php");
?>

    <div id="center-box">
<?php 
include("includes/header_img.inc.php");
?>
        <div id="left-right-padding">
<?php 
include("includes/navigation.inc.php");
?>

<?php
//division

if(isset($_GET['meters']))
{    
     echo 
"<div id='bmiBox' style='border: 1px solid #fff; background: #ccc; width: 200px;'>";
 
    
$height_m $_GET['meters'];
    
$weight_kg $_GET['weight'];
    
$num_of_decimals 2;
    
$bmi $weight_kg/($height_m*$height_m);
    
$bmi number_format($bmi$num_of_decimals);
    
    
$underweight 18.5;
    
$normal=25;
    
$overweight=30;
    
    if(
$bmi<$underweight){
        echo 
"skinny";    
    }else if(
$bmi>$underweight && $bmi $normal)
    {
        echo 
"normal";    
    }
    else if(
$bmi>$normal && $bmi $overweight)
    {
        echo 
"overweight";    
    }
    else
    {
        echo 
"fat";    
    }

    echo  
$bmi;
    
    echo 
"</div>";
}
?>

            <form action="" method="get">
                <fieldset><legend>Meter:</legend>
                <input type="text" name="meters" />
                <legend>Weight:</legend>
                <input type="text" name="weight"/>
                <input type="submit" name="submit_bmi" value="Udregn"/>
                </fieldset>
            </form>
        </div>
        <br/>
        <br/>
<?php 
include("includes/footer.inc.php");
?>

    </div>
</div>
</body>
</html>