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 this? (PHP)

The task say:

"Now echo Mike's Name To The Screen."

I don't know how make well the challenge.

index.php
<?php

$name = "Mike";

?>

<title><?php echo $name ?></title>

4 Answers

yeah, it just wants it in the same php block.

Thank you! for your answer. Now I know the correct form, I'm sharing it for other students:

<?php $name = "Mike"; echo $name; ?>

Hi,

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>

put a semicolon after the echo $name . like -

<?php

$name = "Mike";

?>

<title><?php echo $name; ?></title>

thanks! But it not working yet.

Maybe the challenge wants you to echo it without the < title > tags.

Thank you Sara for your answer. Now I know the correct form, I'm sharing it for other students:

<?php $name = "Mike"; echo $name; ?>