HI Guys

I am using the following code that creates html form elements dynamically but there is one problem.


Code:
<html> 
<head> 
<title>Adding and Removing Text Boxes Dynamically</title> 
<SCRIPT language="javascript"> 
var intTextBox=0; 

//FUNCTION TO ADD TEXT BOX ELEMENT 
function addElement() 
{ 
intTextBox = intTextBox + 1; 
var contentID = document.getElementById('content'); 
var newTBDiv = document.createElement('div');
var submit = document.getElementById('submit').style.visibility="visible";
newTBDiv.setAttribute('id','strText'+intTextBox); 
newTBDiv.innerHTML = "Serial numbers "+intTextBox+ "<input type='checkbox' id='cb" + intTextBox + "' name='cb[]'/>" + ": <input type='text' id='nm" + intTextBox + "' name='nm[]'/> -- <input type='text' id='vl" + intTextBox + "' name='vl[]'/><br/><br/>";
contentID.appendChild(newTBDiv);
} 

//FUNCTION TO REMOVE TEXT BOX ELEMENT 
function removeElement() 
{ 
if(intTextBox != 0) 
{ 
var contentID = document.getElementById('content'); 
contentID.removeChild(document.getElementById('strText'+intTextBox)); 
intTextBox = intTextBox-1; 

if(intTextBox < 1) {
document.getElementById('submit').style.visibility="hidden";

}


} 
} 
</SCRIPT> 
</head> 
<body> 
<p>Demo of Adding and Removing Text Box Dynamically using JavaScript</p> 

<form action='post.php' method='post'>
<div id="content"></div>
<div id="submit" style="visibility: hidden;">
<input type='submit' value='submit'> 

</div>
</form>
<p><a href="javascript:addElement();" >Add</a> <a href="javascript:removeElement();" >Remove</a></p>
</body> 
</html>

And I am getting an output like the following.

Code:
Array
(
[cb] => Array
(
[0] => on
[1] => on
)

[nm] => Array
(
[0] => a
[1] => b
)

[vl] => Array
(
[0] => 1
[1] => 2
[2] => 3
)

)

Now, in the above output how do I know pragmatically which checkbox values were checked and which textbox were filledup?

If there is anyway we can use names of the elements instead of indexed arrays? For example

Code:
Array
        (
            [t_x] => 1
            [t_y] => 2
            [t_z] => 3
        )

THanks[/QUOTE]