Retrieve values from URL

Hi fellas,

I need to get the variables from a URL but in my case, I wont know the variable names, is it possible?


In the example I know the variable ID but the user can set any variable he wishes and I need to get this variable.

The user can set the following:

Thanks in advance

Here I am again, searching hard for it on google, I’ve found it


Problem solved =)

The $_GET variable contains an associated array of the query string.

$_GET might contain:

    'id' => 1,
    'popcorn' => 1,
    'horse' => 'pink'

So, you can use array_keys($_GET) to get an array such as [‘id’, ‘popcorn’, ‘horse’] of all the fields you can access. In this case they would be $_GET[‘id’] and $_GET[‘popcorn’] and $_GET[‘horse’]

foreach (array_keys($_GET) as $key) {
    echo $key . ' is ' . $_GET[$key] . '<br>';