title: php calculator displaying code in webrowser
body: <p>I have been working on a OOP calculator in php however I have a problem: whenever I save it and run it in firefox it shows the code like this </p>
  
  <p><img src="https://i.stack.imgur.com/uyBA5.png" alt="Image"></p>
  
  <p>Stack overflow wants me to add some more description so blah blah blah blah</p>
  
  <p>The code I have been using is</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;?php
  $page = $GET['page'];
  
  class calc{
      var $number1;
      var $number2;
  
          function add($number,$number2)
          {
              $result = $number1 + $number2;
              echo("The sum of $number1 and $number2 is $result&lt;br&gt;&lt;br&gt;");
              echo("$number1 + $number 2 = $result");
              exit;
              }
  
          function subtract($number1,$number2)
          {
              $result = $number1 - $number2;
              echo("$number1 subtract $number2 is $result&lt;br&gt;&lt;br&gt;");
              echo("$number1 - $number2 = $result");
              exit;
              }
  
          function multiply($number1,$number2)
          {
              $result  = $number1 * $number2;
              echo("$number1 multiplied by $number2 is $result&lt;br&gt;&lt;br&gt;");
              echo("$number1 * $number2 = $result");
              exit;
              }
  
          function divide($number1,$number2)
          {
              $result = $number1 / $number2;
              echo("$number1 divided by $number2 is $result&lt;br&gt;&lt;br&gt;");
              echo("$number1 / $number2 = $result");
              exit;
              }
              }
              $calc = new calc();
              ?&gt;
  
  &lt;title&gt;php object oriented calculator&lt;/title&gt;
  &lt;form name="calc" action="?page=calc" method="POST"&gt;
  Number 1: &lt;input type=text name=value1&gt;&lt;br&gt;
  Number 2: &lt;input type=text name=value2&gt;&lt;br&gt;
  Operation: &lt;input type=radio name=oper value="add"&gt;Addition &lt;input type=radio name=oper value="subtract"&gt;Subtraction &lt;input type=radio name=oper value="divide"&gt;Division &lt;input type=radio name=oper value="multiply"&gt;Multiplication&lt;/input&gt;&lt;br&gt;
  &lt;input type=submit value="Calculate"&gt;
  &lt;/form&gt; 
  
  &lt;?php
  if($page == "calc"){
  $number1 = $_POST['value1'];
  $number2 = $_POST['value2'];
  $oper = $_POST['oper'];
      if(!$number1){
          echo("You must enter number 1!");
          exit;
          }
          if(!$number2){
              echo("You must enter number 2!");
              exit;
              }
          if(!$oper){
              echo("You must select an operation to do with the numbers!");
              exit;
              }
          if(!eregi("0-9", $number1)){
              echo("Number 1 MUST be numbers!");
              exit;
              }
          if(!eregi("0-9", $number2)){
              echo("Number 2 MUST be numbers!");
              exit;
              }   
          if($oper == "add"){
              $calc-&gt;add($number1,$number2);
              }
  
          if $oper =="subtract"){
              $calc-&gt;subtract($number1,$number2);
              }
          if $oper = "multiply"){
              $calc-&gt;multiply($number1,$number2);
              }
          if $oper = "divide"){
              $calc-&gt;divide($number1,$number2);
              }
              }
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>