elabuwa Posted September 28, 2009 Share Posted September 28, 2009 Hi guys, I have a page that allows the user to add textbox when a button is clicked. Adding a textbox with a button click is working fine. <TD width="144"><INPUT type="text" name="debit[]"/></TD> I have named it as debit[] because it believe the user will enter 2 or more values. the problem is only the first text box value gets passed through to the next page. the code to getting the array value in the next page is $txtbox = $_POST['debit']; while (list($a, $b) = each($txtbox)) { echo "Key: $a; Value: $b<br />\n"; } AND i tried this foreach ($txtbox as $key => $value) { echo "Key: $key; Value: $value<br />\n"; } And I tried this echo $txtbox[0]; echo $txtbox[1]; What ever I try only the first array index value gets displayed. can you guys please help me out. below is the code for adding rows. just thought you might like to have a look at it. <SCRIPT language="javascript"> function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var colCount = table.rows[0].cells.length; for(var i=0; i<colCount; i++) { var newcell = row.insertCell(i); newcell.innerHTML = table.rows[0].cells.innerHTML; //alert(newcell.childNodes); switch(newcell.childNodes[0].type) { case "text": newcell.childNodes[0].value = ""; break; case "checkbox": newcell.childNodes[0].checked = false; break; case "select-one": newcell.childNodes[0].selectedIndex = 0; break; } } } Quote Link to comment https://forums.phpfreaks.com/topic/175746-solved-only-arrayname0-value-gets-passed/ Share on other sites More sharing options...
Zane Posted September 28, 2009 Share Posted September 28, 2009 table.rows[0].cells.innerHTML Quote Link to comment https://forums.phpfreaks.com/topic/175746-solved-only-arrayname0-value-gets-passed/#findComment-926151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.