get data from url php code example
Example 1: getting values from url php
$id = $_GET['id'];
// OR
$id = $_REQUEST['id'];
Example 2: php get data from url
// previous link
<a href="test_get.php?subject=PHP&web=W3schools.com">Test $GET</a>
// the code
<?php
echo "Study " . $_GET['subject'] . " at " . $_GET['web'];
?>
Example 3: send data with url in php
// Send the variables myNumber=1 and myFruit="orange" to the new PHP page...
<a href="page2.php?myNumber=1&myFruit=orange">Next page</a>