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

HELP! php displaying problem in web browser

I have a problem, I just started learning in PHP course. When I write a simple code like:

<h1><?php echo "Shirts 4 Mike"; ?></h1>
<p> The current time is <?php date("h:i:s a"); ?>.

it displays in web browser only:

The current time is .

Can anyone know what a problem is? Greetings.

3 Answers

Hi Bosko,

You forgot to echo the result. Try:

<h1><?php echo "Shirts 4 Mike"; ?></h1>
<p> The current time is <?php echo date("h:i:s a"); ?>.</p>

Hi Hugo, Yeah I changed it, but it also shows the same resul. I dont know what the problem is.

Are you running it on your machine? Do you have a local server like xampp installed?

I dont have it. Looks like i didnt installed it. Okay thank you Hugo you are very helpful :)

You can use treehouse workspaces to try code if you like.

You can use treehouse workspaces to try code if you like.

Oh okay. Thanks one more time :)