Page 1 of 1

PHP embeded in HTML

Posted: Fri Jan 07, 2011 4:49 pm
by El Vasco
Hi All,
I am struggling to get the embeded PHP running in my development enviroment without success...
I write the code below and the only message I get in the browser is:

TEST FROM HTML

When I do "View Source" I get:

Code: Select all

<html>
<head>
<title> Prueba </title>
</head>
<body>
<h1> TEST FROM HTML </h1>
<?php echo '<h1>TEST FROM PHP</h1>';?>
</body>
</html>
What I guess means PHP is just not running... Any suggestions or clues about what I am doing wrong... ?

Thanks !
El Vasco

Re: PHP embeded in HTML

Posted: Fri Jan 07, 2011 4:54 pm
by Neilos
If that is what you see when you view source then the php is not being parsed. Most likely you have put php in a .html file. If this is the case you will need to change the .html to .php. If you cannot do this as you already have incoming links then you can try things like http://php.about.com/od/advancedphp/p/html_php.htm

Re: PHP embeded in HTML

Posted: Fri Jan 07, 2011 6:06 pm
by El Vasco
Thank You, Neilos ! You are completly right. I was trying to run PHP from a .html file :( ... I will read the information in the link you sent me.
Thanks !
El Vasco

Re: PHP embeded in HTML

Posted: Fri Jan 07, 2011 6:09 pm
by Neilos
It's an easy mistake, God knows we all make them! lol. Beware though the link I gave was just the first I found, I didn't even read it so I don't know if it is a good option but at least you now know what to look for :)

Glad to have helped.