title: Call php function when click a button
body: <p>I have a code :</p>
  
  <pre><code>&lt;?php
  getPriceListHeader();
  
   function getPriceListDetail($PriceListCode)
  {
      $resource = Mage::getSingleton('core/resource');
      $readConnection = $resource-&gt;getConnection('core_read');
  
      $query = "SELECT * FROM pricelisdetail where pricelist_code='".$PriceListCode."'";
      $results = $readConnection-&gt;fetchAll($query);
      echo "&lt;table id='tbdata'&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th&gt;Price List Code&lt;/th&gt;
                              &lt;th&gt;Price List Name&lt;/th&gt;
                              &lt;th&gt;Effective From&lt;/th&gt;
                              &lt;th&gt;Effective To&lt;/th&gt;
                          &lt;/tr&gt;
                      &lt;/thead&gt;
          &lt;tbody&gt; ";
      foreach ($results as $row)
      {
          echo "&lt;tr&gt;";
          echo "&lt;td&gt; ".$row[entity_id];
          echo "&lt;td&gt; ".$row[sku];
          echo "&lt;td&gt; ".$row[sku];
          echo "&lt;td&gt; ".$row[sku];
      };
      echo "   &lt;/tbody&gt;
      &lt;/table&gt; ";
  }
  
  
   function getPriceListHeader()
  {
      $resource = Mage::getSingleton('core/resource');
      $readConnection = $resource-&gt;getConnection('core_read');
  
    $query = 'SELECT * FROM pricelistheader';
      $results = $readConnection-&gt;fetchAll($query);
      echo "
              &lt;h2&gt;Price List&lt;/h2&gt;
              &lt;div&gt;
              &lt;h3&gt;Please select Price List&lt;/h3&gt;
              &lt;div&gt;
              &lt;select class='element select large' id='pricelist' name='element_2'&gt;";
      foreach ($results as $row)
      {
              echo '&lt;option value="' . $row[entity_id]. '"&gt;' . $row[sku] . '&lt;/option&gt;';
      }
        echo "&lt;/select&gt;
              &lt;/div&gt;
              &lt;input type='button' class='button' name='insert' value='Get Data' onclick='getPriceListDetail(pricelist.value)'/&gt;
  
              ";
      getPriceListDetail('');
  }
  ?&gt;
  </code></pre>
  
  <p>I have a dropdown list, a button, a table
  When I select a value from dropdown list, then I click button , table will be filled data again. There are 2 method, <code>getPriceListHeader():</code> load data header when load the page, getPriceListDetail : load data detail when click a button.  I try to put event <code>getPriceListDetail(value)</code> to button, but when I click, nothing happens<br>
  Please help me how to do this.</p>
  
  <p><a href="https://i.stack.imgur.com/eYMy5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eYMy5.png" alt="enter image description here"></a></p>