title: How to get value from Javascript to input text form?
body: <p>I have a select form with kinds of hotel rooms like ordinary, family, deluxe, executive and so on each of it has a corresponding price let us say in ordinary room i will set $300 price.</p>
  
  <p>At the right side of the select form everytime I choose let us say ordinary room the right side input text field it will reveal the price $300. So basically I use java script with the code <code>var ordinary=document.getElementByID("ord").value</code> so that i can set the price so, <code>var ordinary= 3500</code>. The next is getting the value from variable ordinary to be reveal in input text field every time I choose the Ordinary room in the selection form, but how am i going to do that?</p>
  
  <p>Here's the code</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
      var ordinary= document.getElementById("ord").value;
      var ordinary= 5300;
  
  &lt;/script&gt;
  
  &lt;form action="insert.php" method="post"&gt;
      &lt;table align="center"&gt;&lt;tr&gt;&lt;td&gt;
              &lt;font face="Arial, Helvetica, sans-serif"&gt;RESERVATIONS&lt;/font&gt; 
          &lt;/td&gt;&lt;/tr&gt;&lt;hr color="#00CC99"/&gt; &lt;br/&gt;
      &lt;/table&gt;
      &lt;table border="0" align="center"&gt;
          &lt;tr&gt;    
              &lt;th align="justify"&gt; Name: &amp;nbsp &lt;/th&gt; 
              &lt;td&gt;&lt;input type="text" name="name"&gt;&lt;/td&gt; 
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th align="justify"&gt; Contact Number: &amp;nbsp; &lt;/th&gt; 
              &lt;td&gt;&lt;input type="text" name="contact"&gt;&lt;/td&gt; 
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th  align="justify"&gt;Room Type: &amp;nbsp;&lt;/th&gt;
          &lt;td&gt;
              &lt;select name="roomType"&gt;
                  &lt;option value="---"&gt;---------------------------&lt;/option&gt;
                  &lt;option value="Ordinary " id="ord"&gt;Ordinary&lt;/option&gt;
                  &lt;option value="Family "&gt;Family&lt;/option&gt;
                  &lt;option value="Superior "&gt;Superior&lt;/option&gt;
                  &lt;option value="Deluxe "&gt;Deluxe&lt;/option&gt;
                  &lt;option value="Corner Suite King"&gt;Corner Suite King&lt;/option&gt;
                  &lt;option value="Executive "&gt;Executive&lt;/option&gt;
                  &lt;option value="Executive Suite"&gt;Executive Suite&lt;/option&gt;
                  &lt;option value="Grand Executive"&gt;Grand Executive&lt;/option&gt;
                  &lt;option value="Presidential "&gt;Presidential&lt;/option&gt;
              &lt;/select&gt;
          &lt;/td&gt;
              &lt;td&gt;
  
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th align="justify"&gt;AddOn Services: &amp;nbsp;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>