John
John

Reputation: 17

Accessing the query string in a document

How can I place the value of a variable from the URL query string (e.g., ?location=london) into an HTML page?

I currently have been trying to do this and implemented a url parser and placed it inside the html page with this

<span id="location"></span>

near the area that I want it to belong, unfortunately this didn't seem to work.

Upvotes: 1

Views: 80

Answers (1)

k to the z
k to the z

Reputation: 3185

This should get you what you need.

   echo $_GET['location'];

Upvotes: 1

Related Questions