Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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?

http://localhost/contact-thanks.php

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.