php get value of input code example

Example 1: get text field value in php

<form method="post">
  <input type="text" name="deleteinput" class="button"/>
  <input type="submit" name="deletebtn" class="button" value="Delete single user data"/>
</form>
  // php 
<?php 
    $name = $_GET['deletebtn'];
    echo $name;
?>

Example 2: php post variables to another page with submit button php

<html>
<form id="form" action="webAddressYouWantToRedirectTo.php" method="POST">
<input type="hidden" name="expectedPOSTVarNameOnTheOtherPage" value="<?php echo $varYouMadePreviouslyInProcessing ?>">
</form>
<script>
document.getElementById("form").submit();
</script>
</html>