Using if(isset($_POST['submit'])) to not display echo when script is open is not working



PHP Snippet 1:

<p><input type="submit" value="Submit" name="submit" /></p>

PHP Snippet 2:

if(isset($_POST['submit']))

PHP Snippet 3:

<input type="submit" name="submit" value="Submit" />

PHP Snippet 4:

<form class="navbar-form navbar-right" method="post" action="login.php">
  <div class="form-group">
    <input type="email" name="email" class="form-control" placeholder="email">
    <input type="password" name="password" class="form-control" placeholder="password">
  </div>
  <input type="submit" name="submit" value="submit" class="btn btn-success">
</form>

PHP Snippet 5:

if(isset($_POST['submit']) && !empty($_POST['submit'])) {
  // if (!logged_in()) 
  echo 'asodj';
}

PHP Snippet 6:

<input type="submit" value"Submit" name="login">

PHP Snippet 7:

<input type="submit" value"Submit" name="example">

PHP Snippet 8:

$var = strip_tags($_POST['example']);
if (isset($var)){
    // your code here
}

PHP Snippet 9:

$_SERVER['REQUEST_METHOD'] == 'POST'