Update database information with onClick function
<p>I am trying to update a tables row <strong>site_active</strong> in mysql using an onClick function with a button.</p>

<p>My button code is: </p>

<pre><code>&lt;button onClick='site_active()' id='site_active'&gt;&lt;?php echo $client-&gt;site_active; ?&gt;&lt;/button&gt;
</code></pre>

<p>And then of course my Script is: </p>

<pre><code>&lt;script&gt; 
   function site_active() 
   {
      alert("Site Updated"); 
   } 
&lt;/script&gt;
</code></pre>

<p>I am sure that I need to use a php function to make this happen and I have the following code from my attempt to just do it with a form. </p>

<pre><code>&lt;?php 
$con=mysqli_connect("INFORMATION REMOVED"); 
//Check connnection 
if (mysqli_connect_errno()) 
{ 
echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
} 

mysqli_query($con, "UPDATE mypanda_clients SET site_active='$_GET[site_active]' WHERE id='$_GET[id]'"); 

mysqli_close($con); 
?&gt;
</code></pre>

<p>The form option did not work because of some clashing problems in the website. ANY help would be great as I have spent hours on this with no progress. Thank You.</p>
