title: How to create a dynamic drop down list in html from values in database?
body: <p>How can I create a dynamic drop down list for my html page but use values from a database to populate the available drop down items in one box based on the value of another? It is identical to something where you select state from one drop down and in dropdown 2 there are the cities, you select city and you can select the zip codes from another.I have been searching on the net but I can not find anything that demonstrates using a database. Does anyone have some examples they can post? I am learning using the code below, I can add from a text box but nothing when pulling from a database? Does javascript actually have to make the connection and if so how do you protect the credentials to the dB? </p>
  
  <pre><code>function addCombo() {
      var textb = document.getElementById("txtCombo");
      var combo = document.getElementById("combo");
  
      var option = document.createElement("option");
      option.text = textb.value;
      option.value = textb.value;
      try {
          combo.add(option, null); //Standard 
      }catch(error) {
          combo.add(option); // IE only
      }
      textb.value = "";
  }
  </code></pre>