title: Printing text box value on page in PHP
body: <p>I am new to PHP (in-fact I am learning it). I am trying to get the value of textbox defined in HTML and print it on HTML page through PHP code. I am able to send the value of textbox to another page using form post and getting it using <code>$_POST['name']</code> on other page.</p>
  
  <p>I am not able to print the value of textbox on same page.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;?php
  
              function myfunction()
              {
                  printf($_POST['fname']);
              }
  
          ?&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
  
          Name: &lt;input type="text" name="fname" /&gt;
  
          &lt;input type="button" onClick="myfunction()" value="Click" /&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>