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 trialRifqi Fahmi
23,164 Pointswhat the meaning of this sentence in this video??
I still didn't understand what the meaning of this sentence in this video:
if that variable doesn't exist at all, then this conditional would
generate a notice that might be visible in the browser.
anyone can explain it to me :) ?? thanks :)
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Rifqi,
What Randy is trying to say is that without also checking to see if the variable is set, the conditional could return an error that could possibly show up on the website's page, which you don't want because that would confuse the visitor. Instead, you check to make sure it is set and equal to ...
So, both conditions need to be met before that block will run. Now, if it isn't set, it won't try to return a non-existent variable and won't throw an error. It will just go back to the contact screen.
Does that make sense?
:)
Rifqi Fahmi
23,164 PointsOK thanks jason, now that make sense to me :)
Rifqi Fahmi
23,164 PointsRifqi Fahmi
23,164 Pointsis the error happen because the conditional statement run ?? how is the error look like ?? how that conditional statement run when there is no variable which meant exist ?? :)
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsIf I remember this course correctly, the GET variable is set when the form is successfully submitted, and the variable 'thanks' would then be set.
If for some reason (and there could be many) the contact form fails in what is was programmed to do, then the GET variable would not be set and therefore would not technically exist. This is what
isset
is checking for. Without that check, if something did go wrong, an error could be thrown to the page.