title: make a if statement run only when submit button is clicked
body: <p>Here i have a form and some php code to run only when submit button is clicked.But the "IF" block run as soon as the page reloads.As if the $_POST array is not empty.I can try with a single element,like <code>!empty($_POST['name'])</code>.But i want to test on universal $_POST array.How can i do it?</p>
  
  <pre><code>&lt;?php 
  require_once 'input.php';
  
   if(Input::exists()){
    print_r($_POST);
    $arr=array('ball');
    echo $arr[0];
  }
  ?&gt;
  
  &lt;form action='' method='POST'&gt;
     name:&lt;input type='text' name='name' &gt;&lt;/br&gt;
     &lt;input type='submit' value='submit'&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>input.php file:</p>
  
  <pre><code>  class Input{
       public static function exists($type='post'){
           switch($type){
  
             case 'post':
                 return (!empty($_POST))?true:false;
                 break;
              default:
                 return (!empty($_GET))?true:false;
                 brek;
  
           }
       }
    }
  </code></pre>