title: disabling combo box on selection of option of another combo box
body: <p>I want to disable 2nd combo box if 1st combo box selection is the "formative" option. I would like to do it without refreshing the page and I am using PHP. Can anyone help? </p>
  
  <p>P.S.: if the user selects the "submative" option, I want to get the 2nd combo box value in a variable as and when he/she chooses the option.</p>
  
  <p>I am really stuck as I am new to PHP. If someone can help I will be grateful.</p>
  
  <p>Below is the code:</p>
  
  <pre><code>echo'&lt;select&gt; &lt;option valuet=" " selected="selected"&gt;Choose one&lt;/option&gt;';
  echo '&lt;option valuet=1&gt;formative&lt;/option&gt;';
  echo '&lt;option valuet=2&gt;Submative&lt;/option&gt;';
  echo "&lt;/select&gt;";
  
  $quizzes.... //query to get data from sql
  echo'&lt;select&gt; &lt;option valuer=" " selected="selected"&gt;Choose....&lt;/option&gt;';
  foreach($quizzes as $id2 =&gt; $name) 
  {
  echo "&lt;option valuer=".$id2."&gt;".$name."&lt;/option&gt;";
  }
  echo "&lt;/select&gt;";
  </code></pre>
  
  <p><strong>Edited: solved</strong></p>
  
  <p>Thanks to everyone who helped me, you really solved my problem :)</p>
  
  <p>Well this is the answer that solved my question for future use:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function() {
  
  $('#combo_1').change(function(){
      if($(this).val() === '1'){
          $('#combo_2').attr('disabled', 'disabled');
      }else{
          $('#combo_2').attr('disabled', false);
      }
  });
  
  });
  </code></pre>
  
  <p></p>
  
  <p>and in PHP:</p>
  
  <pre><code>echo '&lt;select id="combo_1"&gt;'; 
  echo '&lt;option value=" " selected="selected"&gt;Choose one&lt;/option&gt;';
  echo '&lt;option value="1"&gt;formative&lt;/option&gt;';
  echo '&lt;option value="2"&gt;Submative&lt;/option&gt;';
  echo '&lt;/select&gt;';
  $quizzes = $DB-&gt;get_records_menu('quiz', array('course' =&gt;$courseid),'','id, name');
  echo '&lt;select id="combo_2"&gt;';
  echo '&lt;option value=" " selected="selected"&gt;Choose....&lt;/option&gt;';
  
  foreach($quizzes as $id2 =&gt; $name) {
    echo '&lt;option value=' . $id2 . '&gt;' . $name . '&lt;/option&gt;';
  }
  echo '&lt;/select&gt;';
  </code></pre>