Note that there are some explanatory texts on larger screens.

plurals
  1. PODropdown value depends on another dropdown value
    text
    copied!<p>I have this type of form in which i have one drodown :</p> <pre><code> &lt;b&gt;Please mention Lunch or Dinner or both&lt;/b&gt;&lt;br/&gt; &lt;select name="ldb" id="ldb" onchange="coajax();"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value="1"&gt;Lunch&lt;/option&gt; &lt;option value="2"&gt;Dinner&lt;/option&gt; &lt;option value="3"&gt;Both&lt;/option&gt; &lt;/select&gt; </code></pre> <p>If user selects Lunch then i want to display dropdown :</p> <pre><code> &lt;select name="lunch" id="lunch"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value=""&gt;10-12pm&lt;/option&gt; &lt;option value=""&gt;11-1pm&lt;/option&gt; &lt;option value=""&gt;12-2pm&lt;/option&gt; &lt;/select&gt; </code></pre> <p>and if user selects Dinner then i want to display Dropdown:</p> <pre><code> &lt;select name="dinner" id="dinner"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value=""&gt;4-6pm&lt;/option&gt; &lt;option value=""&gt;5-7pm&lt;/option&gt; &lt;option value=""&gt;6-8pm&lt;/option&gt; &lt;option value=""&gt;7-9pm&lt;/option&gt; &lt;option value=""&gt;8-10pm&lt;/option&gt; &lt;/select&gt; </code></pre> <p>and if user selects both then last two dropdown should display. I tried using ajax :</p> <pre><code> &lt;script type="text/javascript"&gt; function coajax() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } var q="lunch.php?lid=" + document.getElementById("ldb").value; xmlhttp.open("GET",q,false); xmlhttp.send(null); document.getElementById("lunch").innerHTML=xmlhttp.responseText; } &lt;/script&gt; </code></pre> <p>but i got confused.what should I do?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload