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

Problem 2/4 PHP "Variables and conditionals"

Alright so before I spent the time to make this "question" which is more of a comment or an observation than a real question but let me cut to the chase, I spent around 15 minutes working on the 2/4 of this here part of the quiz I couldn't for the life of me figure out what you were asking me to do. I did 1/4 just fine made a nice conditional and everything and it was accepted. I'll show what i did here that it accepted for the first question:

[code]<?php $flavor = "strawberry"; echo "Your favorite flavor of ice cream is " ?><?php echo $flavor; ?> <?php if ($flavor == "cookie dough") { echo "Randy's favorite flavor is cookie dough, also"; } ?>[/code]

Alright so everything's fine and dandy I thought I did a decent enough job with the coding you requested, I get to part two and read the question and was honestly quite confused after reading what you asked me to do at this point I spent the better part of 15-20 minutes fiddling with it before going onto the forums reading what a couple people had to say spending another ten minutes trying to make the code I used on 1/4 work on 2/4. After awhile I go back to the forums and finally see what a classmate posted that was what worked for him 2/4 which I will also post:

[code]<?php $flavor = vanilla; echo "<p>Your favorite flavor of ice cream is "; echo $flavor; echo ".</p>"; echo "<p>Randy's favorite flavor is cookie dough, also!</p>";

?>[/code]

Completely different code. I see now that we were supposed to use what you had placed there but maybe that should have been more clear as I took the text that was there and made it into a more workable code (atleast in my opinion) but regardless maybe some look should be taken into some of the questions wording and how the challenges are setup, my buddy is also having similar problems in another class with the wording on code challenges and a couple other portions of the site.

2 Answers

Hi Josh,

The first code block you posted there contains several more changes than what is requested for task 1 in this challenge. Maybe that was your problem going into task 2. Also, you have several opening and closing php blocks which is unnecessary for this challenge.

Here's some tips on how to post code in the forums for future reference: https://teamtreehouse.com/forum/posting-code-to-the-forum

@Jason Thank you for your input man, after completing the challenge I saw what they were really looking for me to do, but really I am trying to imply that maybe there should be some more robust feedback from the code input for the code challenge the hints should perhaps should be more reactive based upon what the user input and maybe the questions wording could be looked at. Everything about the code challenges seems to be generalized to the point where if you stray or try to do something more complex than the initial request you will get lost like I did.