form action on same page in php code example

Example 1: form action on same page in php

<form action="<php echo $_SERVER['php_shelf'] ?>" method="POST">
  <--
  Your inputs here
  --!>
  
  
 </form>
  
 <?php
  if(isset($_POST['your input name']){
  	$input = $_POST['input name'];
  }
  
  ?>

Example 2: form action on same page in php

<form action="<php echo $_SERVER['php_shelf'] ?>" method="POST">
  <--
  Your inputs here
  --!>
  
  
 </form>
  
 <?php
  if(isset($_POST['your input name']){
  	$input = $_POST['input name'];
  }
  
  ?>

Tags:

Php Example