I have this code and I need to get the count of inputs that I put in inserting the rows and input text form. Please can anyone help me?
function myFunction() {
var table = document.getElementById("mytable");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount - 1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = table.rows[0].cells[0].innerHTML;
cell2.innerHTML = table.rows[0].cells[1].innerHTML;
}
<table id="mytable">
<form method="POST">
<tr>
<td>
<input name="s1[]" type="text" />
</td>
<td>
<input name="s2[]" type="text" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="submit" value="insert" />
</td>
</tr>
</form>
</table>
<button onclick="myFunction()">more</button>
<?php if(isset($_POST[ 'submit']))
{
$count = count($_POST[ 's1']);
echo "<script>alert('".$count. "');</script>";
}
?>