PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Yerfry Ramirez   PHP BMI Calculator   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP BMI Calculator
Calculate the body mass index of a person
Author: By
Last change:
Date: 9 years ago
Size: 649 bytes
 

Contents

Class file image Download
<?php
if(isset($_GET['height'], $_GET['weight'], $_GET['calculate'])):
   
$height = $_GET['height'];
   
$Splitted = str_split($height);
    if(
count($Splitted) == 3):
       
$height = "{$Splitted[0]}.{$Splitted[1]}{$Splitted[2]}";
    endif;

    new
BMI($_GET['weight'], $height);
endif;
?>

<form method="GET" action="<?=$_SERVER['PHP_SELF'];?>">
Height:
<input type="text" name="height" value="" />
<br />
Weight:
<input type="text" name="weight" value="" />
<br />
<button type="submit" name="calculate">Submit</button>
</form>

<br/>
<hr>
Below 18.5 Underweight<br/>
18.5 – 24.9 Normal or Healthy Weight<br/>
25.0 – 29.9 Overweight<br/>
30.0 and Above Obese