Submitting the From

Php $_GET Value is Coming From Another Page, But I Cant Put That $_GET[‘id’] on the Same Page After Submitting the From

 

You can use hidden fields to send additional values with form submit. Like this:

<form action="myOtherFile.php" method="GET">
  <!-- put it anywhere inside the form and give it a desired name and value -->
  <input type="hidden" name="postId" value="PutValueHere" />    

  <!-- and the rest of the form -->
  <input type="text" name="address" value="" />
  <!-- and so on ... -->
  <input type="submit" value="Submit me" />
</form>

In the receiving PHP file you would then get the variable like this:

if(isset($_GET['postId']))
{
    echo "ID is: ".$_GET['postId'];
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here