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


$_GET, $_POST, and other special variables

I was working through the Shirts4Mike project and still am kinda fuzzy on these special PHP variables. I don't think I'm 100% clear on the differences between them and all the purposes that they serve. Can anyone with a good handle on it help me understand?

1 Answer

Aaron Graham
Aaron Graham
18,033 Points

These are superglobals. GET and POST specifically contain the values that were sent along with the http request. For example http://example.com?foo=bar would give $_GET['foo'] a value of 'bar'. POST works in a similar way except it sends the values in the body instead of the url query string.