It will create text box with name=id1,id2,id3..... on clicking the add option. But when I going to fetch the value, it will give an error " Undefined index: id2"
<script>
var i=1;
function myFunction() {
i++;
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("name", "id"+i);
elem = document.getElementById("hide_specific");
elem.appendChild(x);
}
</script>
<body>
<?php
$submission="";
if($_SERVER["REQUEST_METHOD"]=="POST"){$submission=$_POST["id2"];}
?>
<table>
<form action="" method="POST">
<tr>
<td>
<div id="hide_specific"><input type="text" name="id1" ><span onClick="myFunction()">Add</span></div>
</td>
</tr>
<tr> <td><input type="submit" name="set" value="Set"></td></tr>
<tr><td>
<?php echo $submission; ?></td></tr>
</form>
</table>
</body>
issetfunction