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

Hot Bricks Employee
Hot Bricks Employee
10,991 Points

_GET status set and Get Status = thanks Clarification

Can someone explain why we need to test if _GET status is set (isset($_GET["status"])) along with testing the status of _GET status ($_GET["status"] == "thanks"). Why cant we just test latter in this case?

Thanks in advance

-Austin

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Austin,

We do this as PHP will throw an error if status isn't set as a key which the isset function checks for along with ensuring that the value isn't empty.

Hope that helps.

Hot Bricks Employee
Hot Bricks Employee
10,991 Points

@Chris Upjohn -- Ok, great. Thanks for your response. Cheers!