title: Using PHP to code a simple calculator
body: <p>I'm creating a simple BMR calculator that calculates the following formula:
  <em>BMR = 66 + ( 6.23 x weight in pounds ) + ( 12.7 x height in inches ) - ( 6.8 x age in year )</em>.  This code has been borrowed and modified so I'm not completely comfortable with it.</p>
  
  <p>Im curious to as why the '66' is already displayed in answer before I press submit. How can I change my code to not display any values in the answer box until submit is pressed?</p>
  
  <p>The calculator can be found here: 
  <a href="http://rgoo.co/calculators/bmr-calculator.php" rel="nofollow">http://rgoo.co/calculators/bmr-calculator.php</a></p>
  
  <pre><code>&lt;?php
  if (isset($_POST['agev'])) $agev = $_POST['agev'];
  if (isset($_POST['feetv'])) $feetv = $_POST['feetv'];
  if (isset($_POST['inchesv'])) $inchesv = $_POST['inchesv'];
  if (isset($_POST['weightv'])) $weightv = $_POST['weightv'];
  
  $totalheightv = $inchesv + ($feetv*12);
  $answer = 66 + (6.23*$weightv) + (12.7*$totalheightv) - (6.8*$agev);
  echo &lt;&lt;&lt;_END
  &lt;form method='post' action='/calculators/bmr-calculator.php'&gt;
  &lt;table border='0' width='500px' cellpadding='2' cellspacing='1' class="table"&gt;
  &lt;tr class="calcheading"&gt;&lt;td colspan="2"&gt;&lt;strong&gt;IIFYM test&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr class="calcrow"&gt;&lt;td&gt;AGE:&lt;/td&gt;&lt;td align="center"&gt;&lt;input type='text' name='agev' value="$agev"/&gt;Years&lt;/td&gt;&lt;/tr&gt;
  &lt;tr class="calcrow2"&gt;&lt;td&gt;Height:&lt;/td&gt;&lt;td align="center"&gt;&lt;input type='text' name='feetv' value="$feetv"/&gt;Ft&lt;/td&gt;&lt;/tr&gt;&lt;td align="center"&gt;&lt;input type='text' name='inchesv' value="$inchesv"/&gt;In&lt;/td&gt;&lt;/tr&gt;
  &lt;tr class="calcrow"&gt;&lt;td&gt;Weight:&lt;/td&gt;&lt;td align="center"&gt;&lt;input type='text' name='valuec' value="$valuec"/&gt;lbs&lt;/td&gt;&lt;/tr&gt;
  &lt;tr class="submit"&gt;&lt;td colspan="2"&gt;&lt;input type='submit' value='Calculate'/&gt;&lt;/td&gt;&lt;/tr&gt;
  _END;
  ?&gt;
  
  &lt;tr class="calcrow"&gt;
  &lt;td&gt;Your BMR is:&lt;/td&gt;
  &lt;td align="center"&gt;&lt;input type="text" value="&lt;?php echo round($answer)?&gt;"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>