php form get
snippet in php

php form get

user4259

<form method="GET">
  <input type="text" name="someName">
  //The Name Attribute will be put into the _GET inside of php 
  <input type="submit" value="Submit">
 </form>
  
<?php
$var = $_GET("someName");
echo ($var);
?>

php form

user3450

<?php 
/* $_GET */ 
if(isset($_GET['submitGet'])) {
  die($_GET['submitGet'];
}
?>

<!-- GET -->
<form method="GET">
  <input type="text" name="name" placeholder="Name">
  <button type="submit" name="submitGet">Submit $_GET</button>
</form>

<?php
/* $_POST */ 
if(isset($_POST['submitPost'])) {
  die($_POST['submitPost'];
}
?>
      
<!-- POST -->   
<form method="POST">
  <input type="text" name="name" placeholder="Name">
  <button type="submit" name="submitPost">Submit $_POST</button>
</form>