title: How to call a PHP function in JavaScript?
body: <p>I have </p>
  
  <p><b><code>index.php</code></b></p>
  
  <pre><code>&lt;select id="year_list" name="year_list" onchange="check_year_event('year_list', 'event_list');" &gt; . . .  &lt;/select&gt;
  
  &lt;select id="event_list" name="event_list" onchange="check_year_event('year_list', 'event_list');" &gt; . . . &lt;/select&gt;
  .
  .
  .
  &lt;?php 
   function checkYearandEvent($year, $event) {
    $year_event = mysql_query("SELECT * FROM year_event WHERE year = '$event' AND event = '$event'")
  
    if (mysql_num_rows($year_event) &gt; 0) {
     // do this
    }
  
   }
  ?&gt;
  </code></pre>
  
  <p><b><code>myscripts.js</code></b></p>
  
  <pre><code>function check_year_event(year_id, event_id) {
   var year = document.getElementById(year_id).value;
   var event = document.getElementById(event_id).value;
  
   // call PHP function (but I don't know how): checkYearandEvent(year, event);
  
  }
  </code></pre>
  
  <p>My question is how do I call the PHP function every time the user changes the value of any of the <code>select</code> element.</p>