I have a form which has a text box. The user needs to enter a number in the text box, say the user enters the number n , then I further dynamically generate n number of textboxes. The form actions to result.php page where I need the values of these n textboxes. But as I don’t know how many inputs are there how can I predefine the variables that I need to get. I tried doing something like $_GET[‘var’+1]; (the name of the n textboxes being var1,var2,var3… varn) but it doesnot work.
I tried creatind the elements in an array but it doesnot work. The code I used was
var input = new Array();
for(var i=0; i<n; i++)
{
input[i] = document.createElement(‘input’);
input[i].id = ‘input1_’+ i;
input[i].setAttribute(‘name’,’input’+i);
input[i].style.position = ‘absolute’;
input[i].style.top = 50*i+300+’px’;
document.getElementById(‘Form’).appendChild(input[i]);
}
Could you please suggest any better way to get the values ?
Thanks in advance