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

Joseph Kramer
Joseph Kramer
501 Points

Form Submissions Quiz - can't get the right answer

Guys,

I don't remember going over this specifically, but can you help me?

echo $GET["name"] then what needs to be added to the end of the web address http://localhost/contact-thanks.php______ ?

I have a few guesses but can't get it!

4 Answers

Stone Preston
Stone Preston
42,016 Points

get variables are appended to the URL in the form of a query string (?variableName=value) For example, if I had a get variable I wanted the server to access and it was named animal and I wanted it to have the value of cat, I would append

?animal=cat

onto the end of the url

so the full url could look something like

www.example.com/animals.php?animal=cat

in your case the name of the variable is name and the value needs to be Randy

Joseph Kramer
Joseph Kramer
501 Points

Stone's answer was the ticket! The question was asking me to fill in the underscores.

Joseph Kramer
Joseph Kramer
501 Points

Stone, awesome name, that was the answer I needed. Thanks much for the speedy response

Could you elaborate on how the browser goes about pulling the information from and then displaying it?

Thanks in advance

Because of the .php file extension, again: What goes at the end?

Stone Preston
Stone Preston
42,016 Points

unfortunately my knowledge of PHP isnt that extensive, and im not exactly sure HOW the server gets it and does stuff with it. I just know that the variables you pass in the URL are available in the $GET array, just as the information you post in a form is available in the $POST array. I assume there is more stuff happening behind the scenes. Sorry thats probably not the answer you wanted.

Joseph Kramer
Joseph Kramer
501 Points

Cool thanks for the pointers. Actually your summary there on $GET vs $POST helped solidify what I learned in that section.