title: Calling PHP function Onchange on Javascript
body: <p>I want to call a function in php <code>onchange</code> in <code>select</code> of html,how can this be done?</p>
  
  <p>html code</p>
  
  <pre><code>&lt;div class="col-sm-4 form-group"&gt;
     &lt;label for="c_city"&gt;City&lt;/label&gt;
     &lt;select class="form-control" id="c_city" onchange="&lt;?php getArea(); ?&gt;"&gt;
          &lt;option value=""&gt;Select City Name&lt;/option&gt;
          &lt;!--populate value using php--&gt;
          &lt;?php
              $stmt ="SELECT * FROM Cities";
              foreach ($con-&gt;query($stmt) as $row) {
           ?&gt;
           &lt;option value="&lt;?php echo $row['City_ID'];?&gt;"&gt;&lt;?php echo $row['City_Name'];?&gt;&lt;/option&gt;
           &lt;?php
            }
           ?&gt;
     &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>PHP Functions Page</p>
  
  <pre><code>function getArea() 
  {
      if(isset($_GET['c_city'])) 
      {
          $c_city = $_GET['c_city'];
          echo $c_city;
      }
  }
  </code></pre>