Log in

View Full Version : simple syntax error here?



tk403
10-05-2009, 08:04 PM
SOLVED, THANK YOU

I put together a small php script within an HTML page, and I'm getting a bunch of the PHP code showing up on the HTML page, which makes me assume I have a syntax error or stray quotes somewhere. But I can't seem to figure out my mistake. Attached is a screenshot of the HTML output, below is the code. Thanks for any suggestions.


<?php

if (isset($_POST['createTable'])) {
//create initial table
echo "<table>";
//set variables from form input
$rows = $_POST['rows'];
$columns = $_POST['columns'];
//loop to create rows
for ($r = 1; $r <= $rows; $r++) {
echo "<tr>";
//loop to create columns
for ($c = 1; $c <= $columns; $c++) {
echo "<td>&nbsp;</td>";
}
echo "</tr>";
}
echo "</table>";
}

?>