Skip to content
PHP Logo

What is the correct syntax for passing multiple parameters in a URL in PHP?

When passing multiple parameters in a URL in PHP, you can separate each parameter with an ampersand (&) symbol. Each parameter should follow the format key=value. To access these parameters in PHP, you can use the $_GET superglobal array.

php
// Example of passing multiple parameters in a URL
// URL: example.com/page.php?param1=value1&param2=value2

// Retrieving the parameters in PHP
$param1 = $_GET['param1'];
$param2 = $_GET['param2'];

// Output the values
echo "Parameter 1: " . $param1 . "<br>";
echo "Parameter 2: " . $param2;