Use $_POST to get input values

It will execute the whole file as PHP. The first time you open it,
 $_POST['submit'] 
won't be set because the form has not been sent.
   
<?php
  if (isset($_POST['submit'])) {
    $example = $_POST['example'];
    $example2 = $_POST['example2'];
    echo $example . " " . $example2;
  }
?>
<form action="" method="post">
  Example value: <input name="example" type="text" />
  Example value 2: <input name="example2" type="text" />
  <input name="submit" type="submit" />
</form>