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 trialLogan Mayer
9,937 PointsChallenge Task 2 of 2 in PHP Basics
I feel like I must be missing something obvious because for whatever reason, I can't get passed this simple challenge. Anybody see what I'm missing? Thanks in advance for any help.
Challenge: "Now echo Mike's Name To The Screen".
Here is my code, which almost exactly matches what was in the video itself. I've surrounded it with 'body' and 'h1' tags as well and still nothing.
<?php $name = "Mike"; ?>
<h1> <?php echo $name ?> </h1>
Each time, I get this as a response:
Bummer! I am not seeing the word "Mike" in the output. Did you echo something different?
23 Answers
Ryan Watson
5,471 PointsYou are missing a semi-colon after the name variable in the echo statement, and you only need one php block.
both your variable decleration and your echo statement should go inside of a single php block
<?php
variable decleration here
echo statement here
?>
Darren Healy
Front End Web Development Techdegree Student 23,565 PointsHad issues with this despite it being the correct code, let's see a fix TH!
Ali Amirazizi
16,087 PointsI found a possible fix. Refresh your browser and paste in the code again. Should Work.
Herkko Hietanen
30,501 PointsDear Treehouse,
Fix this as there really should be several ways to write the code and none of them are worse really wrong if they meet the task goals.
Adam N
70,280 PointsYou're missing a semi-colon after the name variable, but with that fixed it's still not passing for me.
So technically you're right, Treehouse just doesn't want to give you your 6 points.
Atanas Sqnkov
14,981 Points<?php
$name = "Mike";
echo $name;
?>
This is what I wrote, and I am still getting the Bummer...
Atanas Sqnkov
14,981 PointsI placed a space between the semi-colon and the declarations and it worked!
Is it supposed to be this way?
Spenser Hale
20,915 PointsThis worked for me thank you
Elijah Collins
19,457 PointsThere is a small bug because I wrote the exact same as everyone else here but this line of code should work
<?php
$name = "Mike";
echo $name ;
?>
And no you shouldn't have to put spaces in between decelerations
kkswecpsyl
8,155 PointsI have written it exactly as you have and still get the error.. wtf..
Elijah Collins
19,457 PointsDavid Brenecki I'm not sure where you're getting the error but a step by step is this
Open your php tags, then make a variable named "name" give it a string called "Mike"
<?php
$name = 'Mike';
?>
Echo $name
<?php
$name = 'Mike';
echo $name;
?>
Adam Holms
2,208 PointsThis is a browser issue. I was using Google Chrome with no avail and then tried using Internet Explorer and it worked just fine.
MUZ140787 Ricardo Chitagu
5,364 PointsTreehouse u need to fix this
DeAndre Filer
1,967 PointsThe problem is still not fixed
MUZ140970 Shaune Muringani
11,962 Points<?php $name = "Mike"; echo $name; ?> this worked for me after a long frustrating trials....
jasonjones5
Courses Plus Student 5,571 PointsThis still doesn't work. Tried all the above fixes plus my own experimentation and nothing. Pretty poor to be frank.
Logan Mayer
9,937 PointsAdam, you're right on the missing semi-colon but since it's on it's own line, I didn't think it was necessary, and they didn't include a semi-colon in the video.
After using Ryan's technique and putting everything inside of the same PHP block, it finally worked. I had assumed it wanted something in a separate block outside of the initial PHP block.
Thanks to both of you for your help!
mark uttecht
Courses Plus Student 9,012 PointsI had an issue with this challenge also, turns out I had a <b>blank line 1 and started my code on line 2</b>... deleting the empty line 1 and starting the code on the first line fixed the issue.
Maria Stommes
17,140 PointsCan someone confirm that this is correct? I"m just wondering, because I went back to the video and it pretty much matches verbatim with the exception of the semicolon. (I think that with one line of Php you don't need the semi-colon???)
<?php $name="Mike";?>
<?php echo $name; ?>
David Lockie
7,959 Points<?php $name = "Mike"; echo $name; ?>
I did this and it said "Bummer! I am not seeing the word "Mike" in the output. Did you echo something different?"
Any suggestions?
George Akinian
17,615 Points<?php $name = "Mike"; echo $name; ?>
This code works.
Craig Vanwyk
1,063 PointsIt worked for me
Chris Reynolds
3,627 PointsI had the same issue, until I backspaced the opening <?php so there was was no whitespace at the start, then bingo.
Wouldn't be an issue in reality, bug with the test.
Brendan Mahoney
10,163 PointsYeah, I would try a simple refresh to those of you still having issues. It's unlikely that it's an actual issue with your content. Luckily these steps are fairly painless so a refresh won't lose much progress.
Should work after.
DeAndre Filer
1,967 Points<?php
$name = "Mike"; echo $name;
?>
I am trying the same code and not working.
Ryan Watson
5,471 PointsI'm not sure what the issue is. Your code looks right other than it is not best practice to put two statements on one line, but when I run the code from your example, it works. The code provided below works for me in Chrome Version 43.0.2357.134 m, Firefox Version 39.0, IE Version 11.0.9600.17905, Safari Version 5.1.7 for windows. Hope this helps.
<?php
$name = "Mike";
echo $name;
?>
Mayker Reyes
3,987 PointsUse IE and it will work.
<?php $name = "Mike" ; echo $name ;
?>
Felicia Mabuza
9,408 Points<?php $name = 'Mike';
echo $name;
?>
This is the same code that everyone has. If you are having the same issue with the error message even though your code matches, try refreshing the page and putting the code in again; that eventually worked for me after trying multiple solutions that were to no avail.
Ashenafi Ashebo
15,021 Points<?php
$name = "Mike";
?>
<!DOCTYPE html> <html> <?php echo "Mike"?> </html>
Ashenafi Ashebo
15,021 Pointsdon't forget to include the the the doctype