I’m trying to learn php but something goes wrong…
When I use this code:
<html>
<head>
<title>My first PHP page</title>
</head>
<body>
<?php
echo "<h1>Hello World!</h1>";
?>
</body>
</html>
I’m supposed to just get Hello World! In stead I get: Hello World!”; ?>
However if I just take the php code, save it as a .php file and point my browser to that file it shows Hello World in big bold letters like you’d expect. I’ve tried it om my own computer (with apache and PHP 5.3.15 running) and on the server of my provider with the same faulty results. I’ve tried different browsers, different computers. I’ve also tried other examples from other tutorials (the above example is the most simple that goes wrong) but none of those work as they should. Reading a text file with the include() function works when I open just the .php file but returns an empty canvas when embedded in an html file. I have not yet written a word of code myself, everything is copy/paste so what can be wrong?
Try at http://www.raadvanarbeid.nl/index2.html and http://www.raadvanarbeid.nl/index2.php for the example above.
You must rename your .html file to .php so the server knows it should render the file.