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

Rogean Edwards
Rogean Edwards
7,101 Points

I'm not sure what the tutorial is asking for after i write the conditional.'make sure the message disappears'

I write the conditional statement : if ($flavor == "cookie dough){};

How do I make that text disappear?

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

?>

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Rogean,

You appear to have confused what the task was with something else as you have far too much code to solve the problem for task 3, instead of having your IF statement wrapping a new echo statement it should be wrapping the final echo statement that you have at the end of your IF statement.

Also task 2 shouldn't be passing anymore as you still have vanilla statically defined in the first echo statement whereas it needs to refer to the $flavor variable created in task 1.

See the below.

<?php
$flavor = "vanilla";

echo "<p>Your favorite flavor of ice cream is $flavor.</p>";

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

?>

Happing coding!