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 trialmoath alqutoob
2,450 Pointsi cant understand this section of code
<?php // if status=thanks in the query string, display an thank you message instead of the form ?> <?php if (isset($_GET["status"]) AND $_GET["status"] == "thanks") { ?> <p>Thanks for the email! I’ll be in touch shortly!</p>
charles plata
Courses Plus Student 6,962 PointsThe code above means
If $GET["status"] has a value and the value inside $GET["status"] is equal to the word "thanks" then display message
"Thanks for the email!. I'll be in touch shortly.
1 Answer
Max Smith
Courses Plus Student 3,973 PointsThe isset() method checks if values exist inside the parentheses and the second check, checks if the value returned is equal to "thanks". If both these checks are true, then it runs the HTML underneath, which in this case thanks the user.
$_GET["status"] == "thanks" - Checks if $_GET["status"] is equal to "thanks" (two equal signs means it is checking for a value, where as just one would assign it a value)
isset($_GET["status"] - Checks if $_GET["status"] has a value inside it by using the isset() method
moath alqutoob
2,450 Pointsmoath alqutoob
2,450 Pointsthis code from build-a-simple-php-application what this code do and why he put status