Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I grab all parameters from a URL and print it out in PHP?

Tags:

php

How do I print out all the parameters and their value from a URL without using e.g. print $_GET['paramater-goes-here']; multiple times?

like image 661
SarmenHB Avatar asked Jan 29 '10 06:01

SarmenHB


People also ask

How can I get parameters from a URL string?

The parameters from a URL string can be retrieved in PHP using parse_url() and parse_str() functions. Note: Page URL and the parameters are separated by the ? character. parse_url() Function: The parse_url() function is used to return the components of a URL by parsing it.

How can I get multiple values from GET request URL?

Any word after the question mark (?) in a URL is considered to be a parameter which can hold values. The value for the corresponding parameter is given after the symbol "equals" (=). Multiple parameters can be passed through the URL by separating them with multiple "&".

How do I separate multiple parameters in URL?

URL parameters are made of a key and a value, separated by an equal sign (=). Multiple parameters are each then separated by an ampersand (&).

What does $_ GET do in PHP?

PHP $_GET is a PHP super global variable which is used to collect form data after submitting an HTML form with method="get". $_GET can also collect data sent in the URL. When a user clicks on the link "Test $GET", the parameters "subject" and "web" are sent to "test_get.


1 Answers

I use

print_r($_GET);
like image 117
jab Avatar answered Oct 05 '22 23:10

jab