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

$_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.