title: Insert a checkbox selection value into database as Bit field using PHP
body: <p>I've been through a few similar questions for this, however, with my basic knowledge I haven't been able to find an answer that I can tie directly to what I'm trying to achieve.</p>
  
  <p>For instance, I have found answers regarding arrays to store multiple checkbox values. However, I'm not sure if this is what I need as each of the 3 checkboxes i have are for individual columns in the database.</p>
  
  <p>This is my HTML that i have currently for checkboxes etc:</p>
  
  <pre><code>&lt;form action="addNewClient.php" method="POST"&gt;
            &lt;div class="modal-body"&gt;
              &lt;p&gt;Please enter the name of the client you wish to create.&lt;/p&gt;
              &lt;textarea id="addSQLNoteName" placeholder="Enter client name..." name="title" maxlength="25"&gt;&lt;/textarea&gt;
              &lt;p&gt;Teams Packge:&lt;/p&gt;
              &lt;select name="package"&gt;
                &lt;option value="SBE"&gt;SBE&lt;/option&gt;
                &lt;option value="Enterprise"&gt;Enterprise&lt;/option&gt;
              &lt;/select&gt;
              &lt;br /&gt;
              &lt;input type="checkbox" name="portal" value="1"&gt; Premium Portal
              &lt;br /&gt;
              &lt;input type="checkbox" name="replicated" value="1"&gt; Replicated
              &lt;br /&gt;
              &lt;input type="checkbox" name="client" value="1"&gt; IT Client
              &lt;br /&gt;
              &lt;textarea id="addSQLNoteName" placeholder="Important client info..." name="info" maxlength="25"&gt;&lt;/textarea&gt;
            &lt;/div&gt;
            &lt;div class="modal-footer footer-sqlnotes"&gt;
              &lt;button type="submit" class="btn btn-success"&gt;Add Client&lt;/button&gt;
            &lt;/div&gt;
        &lt;/form&gt;
  </code></pre>
  
  <p>This is my current PHP code and ive made a few comments just showing which ones are the checkboxes:</p>
  
  <pre><code>&lt;?php include 'connectionDetails.php'; ?&gt;
  
  &lt;?php
  
  session_start();
  
  if (isset($_POST['title'], $_POST['package'], $_POST['portal'], $_POST['replicated'], $_POST['client'], $_POST['info']))
  {
      $title = $_POST['title'];
      $package = $_POST['package']; 
      $portal = $_POST['portal'];         //Checkbox
      $replicated = $_POST['replicated']; //Checkbox
      $client = $_POST['client'];         //Checkbox
      $info = $_POST['info'];
  
      $stmt = "INSERT INTO Clients (Client, TeamsPackage, Rating, Pos, Neg, PremiumPortal, Replicated, ITClient, ClientInfo) VALUES (?, ?, 0, 0, 0, ?, ?, ?, ?)";
      $params = array($title, $package, $portal, $replicated, $client, $info);
  
      $stmt = sqlsrv_query($conn, $stmt, $params);
  
      if ($stmt === false) 
      {
          die( print_r(sqlsrv_errors(), true));
      }
  
      header('location: clients.php');
  }
  
  else
  {
      echo "No Data";
  
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>And so in my database, I have three bit field columns, if checked when submitted it will enter as a 1 otherwise it will enter as a 0.</p>
  
  <p>Like I said, I apologise if another question does answer mine, I just couldn't seem to implement it over to what i am trying to achieve.</p>
  
  <p><strong><em>At the moment, if all 3 boxes are checked then it will add the client, otherwise it fails the isset() which is what I'm trying to get around at the moment.</em></strong></p>