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 trialJim McQuarrie
Courses Plus Student 6,529 Pointsecho not working
This is a very simple code challenge but for some reason I can not get the answer to be accepted. The question is Now echo Mikes name using the variable
<?php
$name = "Mike";
?>
I tried these variations
/* option 1 / <?php echo $name ?> /*single line of code no ; needed/ /* option 2 */ Just tried adding <p></p> or <h1></h1. no luck on the quiz
what am I missing?
Jim
<?php
$name = "Mike";
?>
<?php echo $name ?>
2 Answers
Rich Bagley
25,869 PointsHi Jim,
I believe this is due to your code not being in the same php code block (the challenges can get quite specific :) ). Currently you have them in two separate blocks. Can you try combining the two please? e.g.
<?php
$name = 'Mike';
echo $name;
?>
-Rich
Jim McQuarrie
Courses Plus Student 6,529 PointsThis worked, What is strange is that in the lesson all echo blocks were outside of the php code block
Thank you,
Jim
Rich Bagley
25,869 PointsNo problem :)
-Rich
Brenda Krafft
18,036 PointsWow! I am having this exact same problem, but even when I copy and paste the code in from above I still get an error saying "Bummer! I am not seeing the word "Mike" in the output. Did you echo something different?"
Here's the code:
<?php $name = 'Mike'; echo $name; ?>
Am I not seeing something obvious here?