Complete newb question (.php vs .html file)
Posted: Mon Sep 20, 2010 5:30 pm
I'm having a few problems understanding how PHP is integrated with HTML (and/or vice versa); the problem seems to be too much information on the web sometimes.
Anyway, I found this small snipped of code where it was implied that it would run as a .php or .html file but that seems not to be the case. The .php file works fine (outputs five lines of 'Menu Item N'); the .html outputs only one line ('Menu Item').
So my question is: why doesn't the html version work?
<html>
<head></head>
<body>
<ul>
<?php for($i=1;$i<=5;$i++){ ?>
<li>Menu Item
<?php echo $i; ?>
</li>
<?php } ?>
</ul>
</body>
</html>
Thanks for bearing with my newbieness.
Anyway, I found this small snipped of code where it was implied that it would run as a .php or .html file but that seems not to be the case. The .php file works fine (outputs five lines of 'Menu Item N'); the .html outputs only one line ('Menu Item').
So my question is: why doesn't the html version work?
<html>
<head></head>
<body>
<ul>
<?php for($i=1;$i<=5;$i++){ ?>
<li>Menu Item
<?php echo $i; ?>
</li>
<?php } ?>
</ul>
</body>
</html>
Thanks for bearing with my newbieness.