Unable to get php to display on webpage.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

187skillz
Forum Commoner
Posts: 39
Joined: Sun Aug 10, 2003 8:35 pm
Location: London

Post by 187skillz »

well I'm a newbie too, you can't rename it to html extension, it won't work, it has to be .php extension
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Then I rename it to html to see if works.
Think the problem might be there...

Code: Select all

<html>
 <body>
<?php
 echo "foo";
?>
 </body>
</html>
...is the same as...

Code: Select all

<?php
echo "
<html>
 <body>
foo
 </body>
</html>
";

?>
You still need both files with the extension .php
PHP on the server will parse everything outside <?php ... ?> as the normal html. Renaming the file to .html makes PHP on the server not understand that it should look for the <?php ... ?> tags inside the file...
m3rajk wrote:like in anything, before you look to see if it's a zebra, make sure it's not a horse.
Yes. Still, how you present that fact can vary...
Post Reply