I am trying to write code to be able to expand and contract rows and columns from a multiplication table in PHP. This is the code that I currently have that I would think would be able to expand and contract the rows and columns:
<?php
$row=4;
$col=4;
if(isset($_GET["row"]))
{
$row=$_GET["row"];
}
if(isset($_GET["col"]))
{
$col=$_GET["col"];
}
?>
<html style="background-color: #90A7E8;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<html lang="en">
<head>
<body>
<ul>
<?php
echo "<table>";
for($r=1;$r<$row+1;$r++){
echo "<tr>";
for($c=1;$c<$col+1;$c++){
$p=$c*$r;
//~ echo "<td>";
echo "<td>$p</td>";
//~ echo "</td>";
}
echo "</tr>";
}
echo "</table><br>";
$row++;
echo "</ul><a href='math.php?row=$row?col=$col'>more rows</a><br>";
$row-=1;
echo "<a href='math.php?row=$row?col=$col'>less rows</a><br>";
$col++;
echo "<a href='math.php?row=$row?col=$col'>more columns</a><br>";
$col-=1;
echo "<a href='math.php?row=$row?col=$col'>less columns</a><br>";
?>
</body>
</html>
When I run the code, I keep getting this error as well as the inability to expand and contract the columns. I get a non well formed numeric value error on this line of code: for($r=1;$r<$row+1;$r++)
When I attempt to expand and contract the columns, it only contracts the rows.
To summarize, I have a multiplication table I would like to expand and contract the rows and columns using only PHP. When I run the code specified above I get an error saying "A non well formed numeric value encountered" on the line specified above, as well as the inability to expand or contract the columns. Can anyone help me out here?