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 Build a Simple PHP Application Creating the Menu and Footer Variables and Conditionals

Having trouble completing the last challenge task in stage 2 of "Build a simple PHP application/creating the menu and footer/variables and conditionals".

Hello,

I'm having trouble completing the last challenge task in stage 2 (Build a simple PHP application/creating the menu and footer/variables and conditionals, 4 of 4).

My coded answer is rejected (bummer) however when I run the code locally it runs fine and meets the required outcome of the question. The feedback suggests the submitted code no longer satisfies earlier task 3/4. There is no way it can if the task question asks to alter the $flavor variable value.

My code...

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

The result is... Your favorite flavor of ice cream is cookie dough.

Randy's favorite flavor is cookie dough, also!

link.... http://teamtreehouse.com/library/build-a-simple-php-application/creating-the-menu-and-footer/variables-and-conditionals

Is this a bug? Very infuriating as I can't close out the module as a result.

Your quick response is greatly appreciated.

Thank You.

Vicente

7 Answers

I was having the same problem. I believe it is due to changing the original code. Here is the solution that worked for me, provided by Ian Wright.

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

So finally got it to pass me on task 4 of 4! I had to stick with the original code all the way through as Leanne said. Making any tiny change to the original task 1 code text breaks Treehouse's validation scheme, even if your code parses fine.

thanks robert, but i dont know how i did it or what the issue was, but i passed it ages ago. it seemed to be something small and wacky. who knows. i cannot be bothered. it was certainly nothing related to my understanding of the topic.

this is kinda disappointing. ive given up on any actual support from this community or from the teachers. I also emailed the staff of the company about my issue. you can see from the forums that this is an issue for many people.

no disrespect to you , but it takes 9 days to get support on this forum! might as well not even exists! ha! :)

anyway, onward with the next php lesson.

and good luck to all, we will all need it.

this code worked fine for me

<?php

$flavor = "cookie dough";

echo "<p>Your favorite flavor of ice cream is "; echo $flavor; echo ".</p>"; if ($flavor == "cookie dough") { echo "<p>Randy's favorite flavor is cookie dough, also!</p>"; }

?>

I did the same. Literally just found this forum after I worked it out. How are you finding PHP Vicente? I am finding it much more fun than I thought.

I want to be building WordPress themes as soon as possible.

I did the same. Literally just found this forum after I worked it out. How are you finding PHP Vicente? I am finding it much more fun than I thought.

I want to be building WordPress themes as soon as possible.

I am not able to pass this code challenge either...

i have spent around 3 to 4 hours on this. I look at all the forum posts, but they don't seem exactly accurate or relevant to me or my case???

its very disconcerting...this is not hard...all the answers given I already have in my mind and have tried them, but they all fail...can someone help?

take a look at these screen shots as they best illustrate the situation: http://screencast.com/t/ROY4HHLSbfNk you can see here I passed code challenge 3 with the correct answer.

but as you can see when i move to task 4 http://screencast.com/t/HrANRVbtTjot once I change the "flavor variable" to "cookie dough" i know that I am supposed to put something like "){ echo "Randy's favorite flavor is cookie dough, also!"; } ?> but i dont get why nothing I try works? you dont see any code there yet, because I have tried everything. for hours and hours. what do i do?

is there a way to keep carrying on with learning even if we cannot pass a code challenge? I dont believe that my not passing this code challenge reflects a true lack of capability , skill or understanding.

I want to move on! can someone help?

Robert Bullen
Robert Bullen
8,022 Points

try this just found it after hours and hours:

<?php 

$flavor = "cookie dough";
echo "<p>Your favorite flavor of ice cream is "; 
echo $flavor; echo ".</p>"; 
if ($flavor == "cookie dough"){ 
   echo "Randy's favorite flavor is cookie dough, also!</p>"; 
} 

?>
Robert Bullen
Robert Bullen
8,022 Points

You need to add the <p></p> in the right places