Loading

A Simple Calorie Calculator using Php

Submitted by: 
Language: 
Visitors have accessed this post 3900 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

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.