Skip to content

Instantly share code, notes, and snippets.

@simohammedhttp
simohammedhttp / bmi_calculator.php
Created June 2, 2023 19:04
Body Mass Index (BMI) Calculator, for https://www.maxipotion.com/en/
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$weight = $_POST['weight'];
$height = $_POST['height'];
// Validate inputs
$errors = [];
if (empty($weight)) {
$errors[] = 'Weight is required';
}