title: Make Calculator - When Button clicked the No shows in Textbox.
body: <p>Right guys, I am currently learning php, and before you lot say to use javascript instead i am learning php and want it with this code.</p>
  
  <p>Basically i want to kind of replicate the calculator on windows 7, however just with the buttons 0-9,   +   -   /   *    and   =.</p>
  
  <p>before you read the code, i have only built it so far to try and make it work something like this.</p>
  
  <p>You click 1 then it would display on the texbox if you clicked 5 it would put 5 after 1 in the textbox etc...  then when you click an operator such as divide(which is the only one ive tried to code so far as not proceeding as not working) the textbox deletes the numbers but saves the total figure and then any new numbers put in will be divided when the submit button is pressed.</p>
  
  <p>however when i run my code and click any button in my web browser nothing goes into the text box. Any help would really be appreciated. (learning php so that i can progress from 1st line support to web development in same company so this is important)</p>
  
  <p>code is below , i have been using xampp to run it </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Calculator&lt;/title&gt;
  &lt;style&gt;
  #wrapper{
  width:500px;
  height:500px;
  margin:auto;
  border:1px solid;
  }
  #content{
  width:500px;
  height:500px;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  
  
  
  &lt;body&gt;
  &lt;div id="wrapper"&gt;
      &lt;div id="content"&gt;
          &lt;?php
              $answer = $display = $saveddisplay = $newdisplay = $add = $subtract = $divide = $multiply = $num0 = $num1 = $num2 = $num3 = $num4 = $num5 = $num6 = $num7 = $num8 = $num9 =  "";
  
              if($_SERVER["REQUEST_METHOD"] == "POST"){
                  $num0 = ($_POST["number0"]);
                  $num1 = ($_POST["number1"]);
                  $num2 = ($_POST["number2"]);
                  $num3 = ($_POST["number3"]);
                  $num4 = ($_POST["number4"]);
                  $num5 = ($_POST["number5"]);
                  $num6 = ($_POST["number6"]);
                  $num7 = ($_POST["number7"]);
                  $num8 = ($_POST["number8"]);
                  $num9 = ($_POST["number9"]);
                  $add = ($_POST["add"]);
                  $subtract = ($_POST["subtract"]);
                  $divide = ($_POST["divide"]);
                  $multiply = ($_POST["multiply"]);
  
  
  
                  ///////////////////////////////////////////NUMBERS
                  if($_POST["number0"]){
                      $display = $display &amp;&amp; ($_POST["number0"]);
                  }
                  if($_POST["number1"]){
                      $display = $display &amp;&amp; ($_POST["number1"]);
                  }
                  if($_POST["number2"]){
                      $display = $display &amp;&amp; ($_POST["number2"]);
                  }
                  if($_POST["number3"]){
                      $display = $display &amp;&amp; ($_POST["number3"]);
                  }
                  if($_POST["number4"]){
                      $display = $display &amp;&amp; ($_POST["number4"]);
                  }
                  if($_POST["number5"]){
                      $display = $display &amp;&amp; ($_POST["number5"]);
                  }
                  if($_POST["number6"]){
                      $display = $display &amp;&amp; ($_POST["number6"]);
                  }
                  if($_POST["number7"]){
                      $display = $display &amp;&amp; ($_POST["number7"]);
                  }
                  if($_POST["number8"]){
                      $display = $display &amp;&amp; ($_POST["number8"]);
                  }
                  if($_POST["number9"]){
                      $display = $display &amp;&amp; ($_POST["number9"]);
                  }
  
                  //////////////////////////////////////////OPERATORS
                  if($_POST["divide"]){
                      $saveddisplay = $display;
                      $display = "";
                      if($_POST["number0"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number0"]);
                              if($_POST["submit"]){
                                  $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                              }
  
  
  
                      }
                      if($_POST["number1"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number1"]);
                              if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
                      if($_POST["number2"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number2"]);
                              if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
                      if($_POST["number3"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number3"]);
                              if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
                      if($_POST["number4"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number4"]);
                              if($_POST["submit"]){
                                  $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                              }
                      }
                      if($_POST["number5"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number5"]);
                              if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
                      if($_POST["number6"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number6"]);
                              if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
                      if($_POST["number7"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number7"]);
                              if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
                      if($_POST["number8"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number8"]);
                              if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
                      if($_POST["number9"]){
                          $newdisplay = $newdisplay &amp;&amp; ($_POST["number9"]);
                          if($_POST["submit"]){
                              $answer = $saveddisplay / $newdisplay &amp;&amp; $newdisplay = "";
  
                          }
                      }
  
                  }
  
  
  
  
  
  
              }
  
  
  
          ?&gt;
  
  
  
          &lt;form method ="POST" action="&lt;?php  ($SERVER["PHP_SELF"]);?&gt;"&gt;
          &lt;input type="text" width="50" height="20" name="display" value="&lt;?php  echo $display or $newdisplay or $answer;?&gt;"&gt;
  
          &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
          &lt;button type="button" name="number7" value="7" style="width:20px; padding-left:5px; margin-left:2px;"&gt;7&lt;/button&gt;
          &lt;button type="button" name="number8" value="8" style="width:20px; padding-left:5px; margin-left:2px;"&gt;8&lt;/button&gt;
          &lt;button type="button" name="number9" value="9" style="width:20px; padding-left:5px; margin-left:2px;"&gt;9&lt;/button&gt;
          &amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp
  
          &lt;button type="button" name="divide" value="/" style="width:20px; padding-left:5px; margin-left:2px;"&gt;/&lt;/button&gt;
          &lt;button type="button" name="multiply" value="*" style="width:20px; padding-left:5px; margin-left:2px;"&gt;*&lt;/button&gt;
          &lt;button type="button" name="subtract" value="-" style="width:20px; padding-left:5px; margin-left:2px;"&gt;-&lt;/button&gt;
          &lt;button type="button" name="add" value="+" style="width:20px; padding-left:5px; margin-left:2px;"&gt;+&lt;/button&gt;
          &lt;br&gt;&lt;br&gt;
  
          &lt;button type="button" name="number4" value="4" style="width:20px; padding-left:5px; margin-left:2px;"&gt;4&lt;/button&gt;
          &lt;button type="button" name="number5" value="5" style="width:20px; padding-left:5px; margin-left:2px;"&gt;5&lt;/button&gt;
          &lt;button type="button" name="number6" value="6" style="width:20px; padding-left:5px; margin-left:2px;"&gt;6&lt;/button&gt;
  
          &lt;br&gt;&lt;br&gt;
          &lt;button type="button" name="number1" value="1" style="width:20px; padding-left:5px; margin-left:2px;"&gt;1&lt;/button&gt;
          &lt;button type="button" name="number2" value="2" style="width:20px; padding-left:5px; margin-left:2px;"&gt;2&lt;/button&gt;
          &lt;button type="button" name="number3" value="3" style="width:20px; padding-left:5px; margin-left:2px;"&gt;3&lt;/button&gt;
  
          &lt;br&gt;&lt;br&gt;
          &lt;button type="button" name="number0" value="0" style="width:20px; padding-left:5px; margin-left:2px;"&gt;0&lt;/button&gt;
          &lt;button type="submit" value="=" name="submit" style="width:46px; padding-left:5px; margin-left:2px;"&gt;=&lt;/button&gt;
          &lt;/form&gt;
  
  
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  
  
  
  
  
  
  
  &lt;/html&gt;
  </code></pre>