hi guys, got this code from this previous thread: http://www.daniweb.com/web-deveelopment/javascript-dhtml-ajax/threads/416185/adding-rows-to-table-per-click-manipulating-name-field-thereby
the code works fine but how do i modify the code so I will be able to get all the drop down data selected by the user?
let's say there were 5 drop downs that were created and selected how to get all those data?
here's the code from that link above:
<html>
<head>
<title>Adding rows</title>
<SCRIPT language="javascript">
function addRowEntry(tableID){
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
// create a row element
var row = document.createElement("tr");
// add the row to the table
table.appendChild(row);
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[i].innerHTML;
}
// get the select element
var dropdown = row.getElementsByTagName("select")[0];
// get the current total of dropdowns in the table
var total = table.getElementsByTagName("select").length;
// set the name
dropdown.setAttribute("name", "country" + total);
}
</SCRIPT>
</head>
<body>
<form action="passToEvaluationScript.php" method="POST">
<input type='button' value='add row entry' onClick="addRowEntry('myTable');">
<table id="myTable">';
<tr>
<td>
<SELECT name="country1">
<OPTION value="in">India</OPTION>
<OPTION value="de">Germany</OPTION>
<OPTION value="fr">France</OPTION>
<OPTION value="us">United States</OPTION>
<OPTION value="ch">Switzerland</OPTION>
</SELECT>
</td>
</tr>
</table>
<input type="submit" value="submit">
</form>
</body>
</html>