title: PHP: Checking which boxes are marked in a form and then storing those values in a database
body: <p>So the html code displays a form with checkboxes. </p>
  
  <p>The php code is the part I'm having trouble with. </p>
  
  <p>I don't understand why if <code>( isset( $_POST["Submit"] ) )</code> isn't evaluating to true and thus printing "Yes, mail is set". </p>
  
  <p>That's the first and most simplest problem I'm dealing with. </p>
  
  <p>After I find out how to check which boxes are being checked, how do I then store those values as a column on a table of my database on bluehost? </p>
  
  <p>Thank you.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;form method="POST"&gt; 
  &lt;table style="width:300px"&gt;
  
  &lt;tr&gt;
  
    &lt;td&gt;  &lt;font color="#bf2624"&gt;
    Protein 1 &lt;input type="checkbox" name="nutrient[Protein 1]" value="protein 1" /&gt;&lt;br/&gt; &lt;/td&gt;
  
    &lt;td&gt; &lt;font color="#c67622"&gt;
    Carbohydrate 1 &lt;input type="checkbox" name="nutrient[]" value="carbohydrate 1"/&gt;&lt;br/&gt;&lt;/td&gt; 
  
    &lt;td&gt;  &lt;font color ="#0d3aa3"&gt;
    Fat 1 &lt;input type="checkbox" name="nutrient[]" value="fat 1" /&gt;&lt;br/&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  
  &lt;tr&gt;
    &lt;td&gt;  &lt;font color="#bf2624"&gt;
    Protein 2 &lt;input type="checkbox" name="nutrient[]" value="protein 2" /&gt;&lt;br/&gt;&lt;/td&gt;
  
    &lt;td&gt;&lt;font color="#c67622"&gt;
    Carbohydrate 2 &lt;input type="checkbox" name="nutrient[]" value="carbohydrate 2"   /&gt;&lt;br/&gt;&lt;/td&gt; 
  
    &lt;td&gt;   &lt;font color ="#0d3aa3"&gt;
    Fat 2 &lt;input type="checkbox" name="nutrient[]" value="fat 2" /&gt;&lt;br/&gt;&lt;br/&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  
  &lt;tr&gt;
    &lt;td&gt;  &lt;font color="#bf2624"&gt;
    Protein 3 &lt;input type="checkbox" name="nutrient[]" value="protein 3" /&gt;&lt;br/&gt;&lt;/td&gt;
  
    &lt;td&gt;&lt;font color="#c67622"&gt;
    Carbohydrate 3 &lt;input type="checkbox" name="nutrient[]" value="carbohydrate 3" /&gt;&lt;br/&gt;&lt;br/&gt;                         
  
  &lt;/td&gt; 
  
  &lt;/tr&gt;
  
  &lt;tr&gt;
    &lt;td&gt;  &lt;font color="#bf2624"&gt;
    Protein 4 &lt;input type="checkbox" name="nutrient[]" value="protein 4" /&gt;&lt;br/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
    &lt;td&gt;  &lt;font color="#bf2624"&gt;
    Protein 5 &lt;input type="checkbox" name="nutrient[]" value="protein 5" /&gt;&lt;br/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
    &lt;td&gt;  &lt;font color="#bf2624"&gt;
    Protein 6 &lt;input type="checkbox" name="nutrient[]" value="protein 6" /&gt;&lt;br/&gt;&lt;br/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  
  &lt;/table&gt;
  &lt;input type="submit" value="Submit" /&gt;
  &lt;input type='reset' value='Reset'&gt;
  
  
  
  &lt;?php  
  if ( isset( $_POST["Submit"] ) ) { 
      //if (isset($_POST["Protein 1"]) &amp;&amp; !empty($_POST["Protein 1"])) {
          echo "Yes, mail is set";    
      //}else{  
          //echo "No, mail is not set";
      //}
  }
  ?&gt;
  
  &lt;/form&gt; 
  </code></pre>