get url parameters php code example

Example 1: php get

<form action="/" method="get">
  <input type="text" name="name">
  <br>
  <input type="submit">
</form>
<?php
  echo $_GET["query"];
?>

Example 2: Get Parameters From a URL String in PHP

phpCopy<?php 
$url = "https://testurl.com/test/[email protected]&name=sarah";
$components = parse_url($url);
parse_str($components['query'], $results);
print_r($results); 
?>

Example 3: Get Parameters From a URL String in PHP

phpCopy<?php 
echo $_GET['email'] . $_GET['name']
?>

Example 4: php get all url parameters

<?php
  print_r($_REQUEST);
?>

Tags:

Php Example