Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Adding a Contact Form Form Submissions

Quiz Question 5

The $_GET array contains variables added to the web address. If I want my first name (Randy) displayed by this PHP command ...

echo $_GET["name"];

ā€¦ then what needs to be added to the end of the web address?


What's the answer for this, and can someone explain to me as well?

4 Answers

Samiruddin Syed
Samiruddin Syed
3,136 Points

The first key which is appended on the web address is always appended like this www.example.com/something.php?anything=Randy

But where as if i would want to fetch another value along with the "anything" key from the address bar using GET then it would look something like this www.example.com/something.php?anything=Randy&something=Foo

They will be found appended to the url with the following syntax: &key=value

What does it mean by &key=value?

The $_GET is an associative array that will get populated according to the key and value pairs presented on the web address. The question wants you to add the text "name" as the key and the text "Randy" as its value: so you need to add what I wrote in my comment above to the web address and change it accordingly.