向动态表添加行号

How to add row number or serial number for dynamically generated table?? This is my code.

echo"<table>";
for($tr=1;$tr<=$rows;$tr++){

    echo "<tr>";
    for($td=1;$td<=$cols;$td++){
     //  echo "<td>row: ".$tr." column: ".$td."</td>";

        echo "<td><input type='text' name='bhk'></td>";

    }
    echo "</tr>";
}

echo "</table>";

try this

echo"<table>";
for($tr=1;$tr<=$rows;$tr++){

    echo "<tr id=".$tr.">";
    for($td=1;$td<=$cols;$td++){
     //  echo "<td>row: ".$tr." column: ".$td."</td>";

        echo "<td><input type='text' name='bhk'></td>";

    }
    echo "</tr>";
}

echo "</table>";

</div>
echo"<table>";
for($tr=1;$tr<=$rows;$tr++){

    echo "<tr>";
    for($td=1;$td<=$cols;$td++){
        echo "<td>row: ".$tr."</td>";

        echo "<td><input type='text' name='bhk'></td>";

    }
    echo "</tr>";
}

echo "</table>";