title: php, form using the same page after submittion
body: <p>I'm wondering what's the easiest way to make let's say a form with user/pass and submit button with php but after you submit it goes back to the same page instead of going to another php page.</p>
  
  <p>I'm thinking of if/else statement but a bit confused how to set it after lots tries but still not getting the result wanted</p>
  
  <p><em>weird I did all those you guys said before I posted..but...>.&lt;"</em>
  let's say just something simple like this...</p>
  
  <p>but I also want to set if nothing is entered then sumbit is clicked there'll be an error....should be something easy but I don't know why I can't seem to figure it out</p>
  
  <pre><code>&lt;?php
  function userPass()
  {
      echo "&lt;form method='post' action=" . $_SERVER['PHP_SELF'] . "&gt;";
      echo "&lt;input type='text' name='user' /&gt;&lt;br/&gt;";
      echo "&lt;input type='text' name='pass' /&gt;&lt;br/&gt;";
      echo "&lt;input type='submit' value='Login' /&gt;";
  }
      if(empty($_POST["user"]))
      {
          userPass();
      }
      if(!(empty($_POST["user"])))
      {
          if($_POST["user"] == "comp")
          {
              echo "Welcome comp";
          }
          else
          {
              echo "Wrong user";
          }
      }
      ?&gt;
  </code></pre>