js dropdown;populate from sql

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
esandra
Forum Newbie
Posts: 24
Joined: Sun Aug 30, 2009 11:11 pm

js dropdown;populate from sql

Post by esandra »

This script creates dynamic text boxes based on the chosen number from the drop down in php.
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>


thank you very much for your time and have a great day ahead of ya
m_adeel
Forum Newbie
Posts: 4
Joined: Thu Nov 04, 2010 9:05 am

Re: js dropdown;populate from sql

Post by m_adeel »

Don't Understand
explain your complete problem
Post Reply