title: How do I make my database update a value when a checkbox is checked in my table { AJAX }
body: <p>I'm wanting to make my code so that when I click in the checkbox to enable it, it updates a row in my database to the value 1. My checkbox is inside of my table in php and is coded around AJAX. My issue is that when I click the checkbox, 1) it doesn't do anything, (not even refresh the page using my ajax success status) : `                </p>
  
  <pre><code>success: function(data) {
     window.location.replace("admin_members.php");
  }
  </code></pre>
  
  <p>2) It doesn't update my database information giving my column named 'enabled' a value of 1 for when it's checked from the PHP receiver.</p>
  
  <p><strong><em>My Code is Below :</em></strong></p>
  
  <p><strong>Html / PHP Table (checkbox is included in here)</strong></p>
  
  <pre><code>&lt;td style="border: 1px solid #eee; text-align: center; font-size: 11px;" contenteditable="true" onBlur="saveToDatabase(this,'enabled','&lt;?php echo $faq[$k]["id"]; ?&gt;')" onClick="showEdit(this);"&gt;&lt;?php echo $faq[$k]["enabled"]  == 1 ? '&lt;input id="enabled-checkbox" value="1" type="checkbox" checked &gt;' : '&lt;input id="enabled-checkbox" value="1" type="checkbox" &gt;'; ?&gt;&lt;/td&gt;
  </code></pre>
  
  <p><strong>AJAX Sender</strong></p>
  
  <pre><code>        function showEdit(editableObj) {
              $(editableObj).css("background","#FFF");
          } 
  
          function saveToDatabase(editableObj,column,id) {
              $(editableObj).css("background","#FFF url('images/spin.gif') no-repeat right");
              $.ajax({
                  url: "includes/saveedit_members.php",
                  type: "POST",
                  data:'column='+column+'&amp;editval='+editableObj.innerHTML+'&amp;id='+id,
                  success: function(data){
                      window.location.replace("admin_members.php");
                  }        
             });
          }
  </code></pre>
  
  <p><strong>PHP Receiver</strong></p>
  
  <pre><code>if(!isset($_POST['column']) || !isset($_POST["editval"]) || !isset($_POST["id"])) {
      header('Location: error-pages/index.php');
  } else if(isset($_POST['column']) &amp;&amp; isset($_POST["editval"]) &amp;&amp; isset($_POST["id"])) {
      mysqli_query($con, "UPDATE users set " . $_POST["column"] . " = '".$_POST["editval"]."' WHERE  id=".$_POST["id"]);
  }
  </code></pre>
  
  <p><strong>A few picture examples to help understand my database and why I'm trying to do :</strong></p>
  
  <p><a href="https://i.stack.imgur.com/wgWcF.png" rel="nofollow noreferrer">I want it so if the checkbox is checked, automatically refresh page after updating database column 'enabled' to 1</a></p>