Loading

A Simple Calorie Calculator using Php

Submitted by: 
Language: 
Visitors have accessed this post 5044 times.




This is a simple calorie calculator using php, this program calculates how many calorie you need each day in order to maintain your weight! This program uses swith case method.

  1. <?php
  2. $age=$_POST['age'];
  3. $weight=$_POST['weight'];
  4. $height = $_POST['height'];
  5. $calories="0.0215183";
  6. $gender=$_POST['gender'];
  7.  
  8. switch ($gender){
  9. case 'Female':
  10. $gender= 655 + (9.6 * $weight ) + (1.8 * $height) - (4.7 * $age);
  11. echo "<p>Your estimated daily metabolic rate is $gender </p>";
  12. echo "<p>This means that you need rouhgly $gender calories a day to maintain your current weight.</p>";
  13.  
  14. break;
  15. case 'Male':
  16. $gender=66 + (13.7 *$weight) + (5 * $height) - (6.8 * $age);
  17. echo "<p>Your estimated daily metabolic rate is $gender </p>";
  18. echo "<p>This means that you need rouhgly $gender calories a day to maintain your current weight.</p>";
  19.  
  20. }
  21. ?>
Download Code: 

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment