I want to create a table with For loop. As an example I added table created with JavaScript I did before. Firstly I changed the variables ($variable_name=value;) and then the output - echo. I don’t know what mission or wrong. The only output I get is zeros.
This is the output I get:
<html>
<head>
<meta charset="UTF-8"/>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
table,td {
border: 1px solid grey;
border-collapse: collapse;
margin: 10px;
}
img {
display: block;
}
td {
border: 1px solid grey;
width: 33px;
height: 33px;
background-color: silver;
}
</style>
</head>
<body>
<script type="text/javascript">
var r = 10; //vrstica tr
var c = 10; //stoplec td
document.write('<table id=box>');
for(i=1;i<=r;i++) {
document.write("<tr>");
for(j=1;j<=c;j++) {
document.write("<td>"+" "+"</td>");
}
document.write("</tr>");
}
document.write('</table>');
</script>
<?php
echo "<p> 10x10 table </p> ";
$r=10;
$c=10;
echo ("<table id=box>");
for($i=1;$i<=$r;$i++) {
echo ("<tr>");
for($j=1;$j<=$c;$j++) {
echo ("<td>"+" "+"</td>");
}
echo ("</tr>");
}
echo ("</table>");
?>
</body>
</html>