title: How to do the validation for checkbox in php
body: <p>How to do the validation for checkbox on server side php. I wrote an input tag with name type and value very common tags for html. 
  I wrote some code in php after google but didn't work. Any help appreciated.
  html code </p>
  
  <pre><code>....
  &lt;input tags of name&gt;
  &lt;input tags of category with select and options tag&gt;
  &lt;div class="row"&gt;
              &lt;div class="form-check pl-3 pt-1"&gt;
                  &lt;label class="form-check-label"&gt;
                      &lt;input name="checkbox" class="form-check-input" id="checkbox" type="checkbox" value="Check Box"&gt;
                  &lt;a href="#"&gt;Option 1&lt;/a&gt;
                  &lt;/label&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>php code like:</p>
  
  <pre><code>$name = $_POST['name'];
      $checkbox = $_POST['checkbox'];
  
  
      $name_error = "";
      $checkbox_error = "";
  
      if (!isset($checkbox)){
          $checkbox_error = true;
          echo "&lt;span class='alert alert-danger' role='alert'&gt;Please select checkbox&lt;/span&gt;";
      } if { 
  $name error define here...
  } else {
  </code></pre>