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 Build a Simple PHP Application Getting Started with PHP Your First PHP File

Chandler Tayek
Chandler Tayek
5,513 Points

Need help on a challenge...

Here is the question: Here's some code from a basic HTML file. Add a PHP command that would display the name of our website, Shirts 4 Mike, inside the H1 tag. Remember to use an opening PHP tag, a semi-colon, and a closing PHP tag as part of the command.

I thought I did it right but apparently I didn't anyone see my error?

<!DOCTYPE html>
<html>
<body>
    <h1><?php echo Shirts 4 Mike; ?> </h1>
</body>
</html>

I did this and it worked for me

<!DOCTYPE html> <html> <body> <?php $webname= "Shirts 4 Mike";?> <h1><? php echo $webname;?></h1> </body> </html>

2 Answers

Blair Rorani
Blair Rorani
6,658 Points

" " around your string

Jose Luis Lopez
Jose Luis Lopez
19,179 Points

I tried this and worked just fine <!DOCTYPE html> <?php $name = 'Shirts 4 Mike'; ?> <html> <body> <h1><?php echo $name; ?><h1> </body> </html>