diff --git a/index.php b/index.php
index 474f295..c7c0429 100644
--- a/index.php
+++ b/index.php
@@ -98,6 +98,10 @@
+
+
+
+
@@ -372,9 +376,9 @@ function getWeeksOfCurrentMonth() {
return $weeks;
}
-function generateMonthPlan($includeWeekends, $is_female, $weight, $height, $age, $activity_level) {
+function generateMonthPlan($includeWeekends, $is_female, $weight, $height, $age, $activity_level, $bmr = null) {
global $ingredientNutrition, $mealOptionsAndIngredients;
- $bmr = calculateBMR($is_female, $weight, $height, $age, $activity_level);
+ $bmr = is_null($bmr) ? calculateBMR($is_female, $weight, $height, $age, $activity_level) : $bmr;
// https://www.healthline.com/nutrition/best-macronutrient-ratio
// These ranges are recommended by the Institute of Medicine and are widely accepted in nutritional science.
// https://www.nal.usda.gov/programs/fnic
@@ -465,6 +469,7 @@ if ($_SERVER['REQUEST_METHOD'] != 'GET' || !isset($_GET['is_female'], $_GET['wei
$height = (int) $_GET['height'];
$age = (int) $_GET['age'];
$activity_level = (float) $_GET['activity_level'];
+ $bmr = (isset($_GET['bmr']) && !empty($_GET['bmr'])) ? (int) $_GET['bmr'] : null;
- echo generateMonthPlan($includeWeekends, $is_female, $weight, $height, $age, $activity_level);
+ echo generateMonthPlan($includeWeekends, $is_female, $weight, $height, $age, $activity_level, $bmr);
}