'My PHP code is just a comment in my HTML content
I have a basic HTML page with some JavaScript code on it, and when I try to put any PHP code in the body, it reads it as a comment.
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="jquery.tablesorter.pager.js"></script>
<script type="text/javascript">
$(function() {
$("table")
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({container: $("#pager")});
});
</script>
</head>
<body>
<div id="main">
<h1>Demo</h1>
<!-- PHP code in here -->
<?php
echo "test php";
?>
<!--
...
Main code for a table here
-->
</div>
</body>
</html>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
