title: PHP: connecting calculator to GUI
body: <p>I have made a calculator in php I have tried to use a MVC design.
  The calculator is working fine but I would like to connect it to a GUI.
  what I have right now is the php I use to call my class followed by some html wich contain my buttons.</p>
  
  <pre><code>&lt;?php
  //index_input.php
  require_once 'calc.php';
  require_once 'opInterface.php';
  require_once 'op.php';
  
  $c=new Calculator;
  $c-&gt;setOP(new Add);
  $c-&gt;calc(10,50);//20
  $c-&gt;setOP(new Sub);
  $c-&gt;calc(30);//30
  $c-&gt;setOP(new Mult);
  $c-&gt;calc(5);//150
  $c-&gt;setOP(new Div);
  $c-&gt;calc(2);//75
  //echo $c-&gt;getResult();
  ?&gt;
  
  &lt;html &gt;
  &lt;head&gt;
  
  &lt;title&gt;Calculator Demo&lt;/title&gt;
  &lt;link rel="stylesheet" href="style.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="get" action="?page=calc"&gt;
  &lt;!--displays tthe result--&gt;
  &lt;input type="text" name="display" value="&lt;?php echo $c-&gt;getResult();?&gt;"&gt;
  &lt;div class="containor"&gt;
      &lt;div class="opcontainer"&gt;
          &lt;input class="operator" type="button" name="op" value="+"&gt;
          &lt;input class="operator" type="button" name="op" value="-"&gt;
          &lt;input class="operator" type="button" name="op" value="*"&gt;
          &lt;input class="operator" type="button" name="op" value="/"&gt;
      &lt;/div&gt;
      &lt;input class="number" type="button" name="1" value="1"&gt;
      &lt;input class="number" type="button" name="2" value="2"&gt;
      &lt;input class="number" type="button" name="3" value="3"&gt;
      &lt;input class="number" type="button" name="4" value="4"&gt;
      &lt;input class="number" type="button" name="5" value="5"&gt;
      &lt;input class="number" type="button" name="6" value="6"&gt;
      &lt;input class="number" type="button" name="7" value="7"&gt;
      &lt;input class="number" type="button" name="8" value="8"&gt;
      &lt;input class="number" type="button" name="9" value="9"&gt;
      &lt;input class="number" type="button" name="0" value="0"&gt;
      &lt;input id="enter" type="button" name="submit" value="submit"&gt;
      &lt;input class="number" type="button" name="clear" value="clear" &gt;
  &lt;/div&gt;
  &lt;/form&gt;
  
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am having trouble in connecting the buttons to the php code. I am thinking of add some if staements for when opperators are click like so:</p>
  
  <pre><code>if($_POST['op'] =="+"){
      $c-&gt;setOP(new Add);
      $c-&gt;calc(10,10);//20
  }
  </code></pre>
  
  <p>Is this a good way of doing this are do I need to appy differnt methodes?</p>