But what I actually want to do is to use a drop down(generate comboboxes instead
of the textboxes) that I want to populate with values from my sql
table but I don't have any idea how to modify the javascript to do this...
Code: Select all
<html>
<head>
<script>
function make_boxes(v)
{
v=!v?0:v;
document.getElementById("boxes_container").innerHTML = "";
for(var i=0;i<v;i++){document.getElementById("boxes_container").innerHTML += "Box-"+(i+1)+": <input type='text' name='box"+i+"'><br />";}
//the line above creates the text boxes
}
</script>
</head>
<body>
<form action="" method="">
Pick number of boxes:
<select name="numbers" onChange="make_boxes(this.value)"> //this where we choose the number
<option value=""></option>
<option value="5">5</option>
<option value="10">10</option>
<option value="30">30</option>
<option value="50">50</option>
</select>
<p>
<div id="boxes_container"></div> //this is where the text boxes are displayed, also where i want to display the combo boxes
</p>
<p><input type="submit" value="Submit"></p>
</form>
</body>
</html>