How to Calculate BMI(Body Mass Index) Using PHP With HTML Form?

BMI Calculate Create With PHP: You can easily create bmi calculator using php code with html from.

Hello friends today i will tell you through this article how you can create bmi calculator using php.I will try to understand you step to step. so let’s go.

First of all, you create a form using the html code of the bmi calculator.And then add the php code of the bmi calculator to this page or create bmi.php file then add php code og the bmi calculator.As explained below.

BMI Calculator Create by PHP, Create BMI Calculator Using PHP, html and css, BMI CalculatE with html form and PHP

Overview

Step 1:- Create BMI Calculator HTML Form(bmi-calculate.html).
Step 2:- Create BMI Calculator PHP Code(bmi.php).

 

Step 1:- Create BMI Calculator HTML Form(bmi-calculate.html).

 

bmi-calculate.html

<!DOCTYPE html>
<html>
<head>
<title>How to Calculate BMI(Body Mass Index) Using PHP With HTML Form?</title>
</head>
<body>
<form method="GET" action="bmi.php">
Mass in kilogram (kg):-
<input type="text" name="mass">
<br>
Height in meter (m):-
<input type="text" name="height">
<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

 

Step 2:- Create BMI Calculator PHP Code(bmi.php).

 

bmi.php

<?php 
if ($_GET['submit']) {
$mass = $_GET['mass'];
$height = $_GET['height'];
function bmi($mass,$height) {
$bmi = $mass/($height*$height);
return $bmi;
}
$bmi = bmi($mass,$height);
if ($bmi <= 18.5) {
$output = "Under Weight";
} else if ($bmi > 18.5 AND $bmi<=24.9 ) {
$output = "Normal Weight";
} else if ($bmi > 24.9 AND $bmi<=29.9) {
$output = "Over Weight";
} else if ($bmi > 30.0) {
$output = "OBESE";
}
echo "Your BMI value is " . $bmi . " and you are : ";
echo "$output";
}
?>

Cialis (Tadalafil) är den främsta konkurrenten till Viagra (Sildenafil) på marknaden för erektil dysfunktion. köpa Cialis i Sverige föredras av många på grund av sin längre varaktighet och anses vara det mest kostnadseffektiva varumärkesbaserade ED-läkemedlet som finns tillgängligt i Sverige. Cialis finns i två varianter: Cialis och Cialis Daily, och fyra olika doseringar: 2,5 mg, 5 mg, 10 mg och 20 mg, erbjuder Cialis också en rad olika alternativ för att passa patientens behov.