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 trialLuis Joa
4,597 PointsWhat's wrong with this? (PHP)
The task say:
"Now echo Mike's Name To The Screen."
I don't know how make well the challenge.
<?php
$name = "Mike";
?>
<title><?php echo $name ?></title>
4 Answers
Andrew McCormick
17,730 Pointsyeah, it just wants it in the same php block.
Avaronnan Abhinesh
193 PointsHi,
This is because you are using <title> tag. Title is shown in the Top of the browser - not in the browser. So, My answer is working - because u can see the title on top of the browse showing "Mike" You can change the tag to<h1> , then it will print "Mike" as heading......This time -- inside the browser :)
<?php
$name = "Mike";
?>
<h1><?php echo $name; ?></h1>
Avaronnan Abhinesh
193 Pointsput a semicolon after the echo $name . like -
<?php
$name = "Mike";
?>
<title><?php echo $name; ?></title>
Luis Joa
4,597 Pointsthanks! But it not working yet.
Sara Hardy
8,650 PointsMaybe the challenge wants you to echo it without the < title > tags.
Luis Joa
4,597 PointsThank you Sara for your answer. Now I know the correct form, I'm sharing it for other students:
<?php $name = "Mike"; echo $name; ?>
Luis Joa
4,597 PointsLuis Joa
4,597 PointsThank you! for your answer. Now I know the correct form, I'm sharing it for other students:
<?php $name = "Mike"; echo $name; ?>