Bootstrap FreeKB - PHP - GET form data
PHP - GET form data

Updated:   |  PHP articles

In PHP, information can be passed from Page 1 to Page 2 using a $_GET or $_POST request. For example, lets say you have a Click here hyperlink on www.example.com/index.php.

 


GET

First, the Click here hyperlink will need to be configured to pass data to page 2. 

<a href='page2.php?id=1'> Click here </a>

 

In this example, when clicking on the Click here hyperlink, you will be redirected to Page 2, and the URL will contain ?id=1. On page2.php, the following PHP can be used to GET the data from the URL.

<?php
   $id = $_GET['id'];
   echo $id;
?>	

 

1 will be displayed on the page.




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 342c85 in the box below so that we can be sure you are a human.