title: Sort from database tables by multiple checkbox php
body: <p>I have a question about display data from the database alphabetically. 
  I have 2 ckeckboxes and if the nr.1 is checked, it must display data alphabetically from table "companyName" but if chechbox nr.2 is checked, it must display data alphabetically from table "stade".</p>
  
  <p>I am very new to coding, so I will be happy if there was someone who could explain or show me exactly how it should look.</p>
  
  <p>Here is the checkboxes:</p>
  
  <pre><code>  &lt;fieldset&gt;
      &lt;dl"&gt;
          &lt;dt&gt;&lt;label for="sleep"&gt;Sortering:&lt;/label&gt;&lt;/dt&gt;
          &lt;dd&gt;
              &lt;input type="checkbox" name="" value="Alfabetisk A-Z"/&gt;
              &lt;label for="alfabetiskA-z" class="opt"&gt;Alfabetisk A-Z&lt;/label&gt;
              &lt;input type="checkbox" name="" value="Alfabetisk Stade"/&gt;
              &lt;label for="alfabetiskStade" class="opt"&gt;Alfabetisk Stade&lt;/label&gt;
          &lt;/dd&gt;
      &lt;/dl&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>Here is where I show my data fra the database:</p>
  
  <pre><code> echo '
                &lt;table class="tableUser"&gt;
                  &lt;tr class="topColor"&gt;
                    &lt;td&gt;Stade&lt;/td&gt;
                    &lt;td&gt;Firmanavn&lt;/td&gt;
                    &lt;td&gt;Navn&lt;/td&gt;
                    &lt;td&gt;Telefon nr.&lt;/td&gt;
                    &lt;td&gt;E-mail adresse&lt;/td&gt;
                  &lt;/tr&gt;';
  
  
                $class0 = "trColor0";
                $class1 = "trColor1";
  
                $query = mysqli_query($conn,"SELECT * FROM creatUser ORDER BY companyName ASC");
  
                while( $result = mysqli_fetch_array($query)) {
                  $id = $result['id'];
                  $class = "trColor". $i%2;
  
                  echo '
  
                  &lt;tr class="'.$class.'"&gt;
                    &lt;td VALIGN=TOP&gt;'.$result['locationNumber'].'&lt;/td&gt;
                    &lt;td VALIGN=TOP&gt;'.$result['companyName'].'&lt;/td&gt;
                    &lt;td VALIGN=TOP&gt;'.$result['fName'] . ' ' . $result['lName'].'&lt;/td&gt;
                    &lt;td VALIGN=TOP&gt;'.$result['phone'].'&lt;/td&gt;
                    &lt;td VALIGN=TOP&gt;'.$result['eMail'].'&lt;/td&gt;
                  &lt;/tr&gt;';
                  $i++;
  
  
                }
  </code></pre>