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 PHP Basics (Retired) PHP Data & Structure PHP Variables

What's wrong with my syntax for echoing Mike's name?

<?php echo "Mike" ?> I keep being told that "I am not seeing the name "Mike" in the output. I'm confused.

index.php
<html>
  <?php
  $name = "Mike";
?>
<head>
</head>

<body>
  <p><?php echo "Mike"; ?></p>
</body>

</html>

5 Answers

Let me add that I also tried it without the semi-colon because it's on a single line, but I get the same error message.

Richard Walton
Richard Walton
10,861 Points

I tried everything! I went back to look at forum and lots of others have been having the same problem! I tried their fixes, and still nothing? I'm stuck! Why doesn't treehouse step in when this happens, its obviously a quirk in their software and been going on for over 7 months. We should be spending our time learning code and how to fix our mistakes and not there software. I would have thought when there is this much problem they would step in when other members can't help and code is actually correct?

Jose Platas
Jose Platas
19,745 Points

Hello Laura,

Your code is fine but that is not the purpose of the activity. It is asking you to use a variable to print out the name "MIke".

This is what you are suppose to do, something a little more simple.

<?php 

$name = "Mike"; //you assign the variable to Mike
echo $name;     // Then use echo to print

?>
Richard Walton
Richard Walton
10,861 Points

Thanks jose! Laura has probably moved on. Did you you actually apply that code to the challenge? Most who have responded to questions have not. I copied your code exactly! And all I got was "Bummer try again!".

What we need is the person who wrote the challenge or the teacher to respond? I spent a lot of time trying every possible manifestation of php to answer the problem, including yours and nothing! Spaces, no spaces. semi-colon, no semi colons, html, no html, etc. I like most people who work the challenge understand it and can give a working answer ( like yours?) but, to no avail. Since no one from treehouse is responding, maybe someone who thinks they have the answer actually go and apply it to the challenge, and then if it works please respond! Please! I think its great that a lot of us are trying to be helpful, but anything short of something working in the challenge exercise itself is really not helpful and only adds more frustration.

Jose Platas
Jose Platas
19,745 Points

Hello Richard. I actually did apply the code to the challenge and it work just fine. There most be something wrong when the challenge read our answer. It work in my end. Well hopefully the problem will be fix shortly.