title: How to run a PHP function due to a button click (with button 'data' passed)?
body: <p>I know that AJAX could solve my issue. I need help how I can solve it in my specific case however. I manage some sortiment items on a page, they get displayed with a PHP script (checks the database, if the item is available, and if so, it gets displayed). I now want an admin page where I can kind of "toggle" via a sortiment table to display or not display an item (set it as available or non available. </p>
  
  <p>What I need is: if the button is clicked, I would like to start a php-skript. There should be an value passed to that script (the button id). The script itself should open an SQL connection, change a DB value based on the passed ID of the button. Then close the connection. Optionally also refresh the table (or one value) from where the button was clicked. </p>
  
  <p>Can someone help me, at least telling me what I need to do this? (jQuery, Ajax?). The passing of the ID would be important, else I'd need to do function for every button.</p>
  
  <p>An table entry looks like this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;tr&gt;
      &lt;td&gt;Himbeerhonig&lt;/td&gt;
      &lt;td id="himbeerhonig"&gt;Ja&lt;/td&gt;
      &lt;td&gt;&lt;button type="button" id="himbeerhonig" onclick="function()"&gt;press me to execute function&lt;/button&gt;&lt;/td&gt;
  &lt;/tr&gt;```
  
  (possible PHP pseudocode)
  open SQL connection
     look for database entry based on the passed ID
     change the value of the found entry (!currentValue)
  close SQL connection
  
  *optionally*
  refresh the &lt;td id="himbeerhonig"&gt; with the updated value. 
  
  </code></pre>
  
  <p>I appreciate any help very much! Just need some hints as to how to do it properly. It's just a concept that currenty is hard to grasp for me so far.</p>