title: How to write information from html form to MySQL Database
body: <p>Alright, so I'm setting up a website that has a form on it and I want to save all the information that the user types into the form to my MySQL Database. The form is coded like this:</p>
  
  <pre><code>&lt;form method="post" action="claim.php" name="ClaimForm" id="ClaimForm" autocomplete="on"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Contact Details&lt;/legend&gt;
          &lt;div&gt;
              &lt;label for="firstname" accesskey="U"&gt;Your First Name&lt;/label&gt;
              &lt;input name="firstname" type="text" id="firstname" placeholder="Enter your name" required /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="lastname" accesskey="U"&gt;Your Last Name&lt;/label&gt;
              &lt;input name="lastname" type="text" id="lastname" placeholder="Enter your name" required /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="email" accesskey="E"&gt;Email&lt;/label&gt;
              &lt;input name="email" type="email" id="email" placeholder="Enter your Email Address" pattern="^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$" required /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="streetaddress"&gt;Street Address&lt;/label&gt;
              &lt;input name="streetaddress" type="text" id="streetaddress" placeholder="123 Stanley dr." required /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="postalcode"&gt;Postal Code&lt;/label&gt;
              &lt;input name="postalcode" type="text" id="postalcode" placeholder="12345, A1B 2C3, etc." required /&gt;
          &lt;/div&gt;
          &lt;label for="city"&gt;City&lt;/label&gt;
          &lt;input name="city" type="text" id="city" placeholder="Schenectady" required /&gt;
          &lt;div&gt;
              &lt;label for="state"&gt;State/Province&lt;/label&gt;
              &lt;input name="state" type="text" id="state" placeholder="New York" required /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="country"&gt;Country&lt;/label&gt;
              &lt;input name="country" type="text" id="country" placeholder="United States" required /&gt;
          &lt;/div&gt;
      &lt;/fieldset&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Extra&lt;/legend&gt;
          &lt;div&gt;
              &lt;label for="controllers" accesskey="S"&gt;Number of Controllers&lt;/label&gt;
              &lt;select name="controllers" id="controllers" required="required"&gt;
                  &lt;option value="0"&gt;0&lt;/option&gt;
                  &lt;option value="1"&gt;1&lt;/option&gt;
                  &lt;option value="2"&gt;2&lt;/option&gt;
                  &lt;option value="3"&gt;3&lt;/option&gt;
                  &lt;option value="4"&gt;4&lt;/option&gt;
                  &lt;option value="5"&gt;5&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label for="color" accesskey="C"&gt;Color&lt;/label&gt;
              &lt;select name="color" id="color" required="required"&gt;
                  &lt;option value="Black"&gt;Black&lt;/option&gt;
                  &lt;option value="White"&gt;White&lt;/option&gt;
                  &lt;option value="Red"&gt;Red&lt;/option&gt;
                  &lt;option value="Blue"&gt;Blue&lt;/option&gt;
                  &lt;option value="Gold"&gt;Gold&lt;/option&gt;
                  &lt;option value="Purple"&gt;Purple&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
      &lt;/fieldset&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Captcha Verification&lt;/legend&gt;
          &lt;label for="verify" accesskey="V" class="verify"&gt;&lt;img src="captcha.php" alt="Verification code" /&gt;&lt;/label&gt;
          &lt;input name="verify" type="text" id="verify" size="6" required style="width: 50px;" title="This confirms you are a human user and not a spam-bot." /&gt;
      &lt;/fieldset&gt;
      &lt;input type="submit" class="submit" id="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I tried using this code in <code>Claim.php</code> to try and save that to the database:</p>
  
  <pre><code>&lt;?php
  $mysql_host     = "localhost";
  $mysql_username = "username";
  $mysql_password = "password";
  $mysql_database = "database";
  
  mysql_select_db($mysql_database, mysql_connect($mysql_host, $mysql_username, $mysql_password));
  //Sending form data to sql db.
  mysqli_query("INSERT INTO Information (Firstname,Lastname,Email,StreetAddress,PostalCode,City,StateProvince,Country,Controllers,Color) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[email]','$_POST[streetaddress]','$_POST[postalcode]','$_POST[city]','$_POST[state]','$_POST[country]','$_POST[conrollers]','$_POST[color]'))");
  ?&gt;
  </code></pre>
  
  <p>Is there anything wrong with my code? Or is my database structured wrong? I just started learning how to code and this is confusing me.</p>
  
  <p>Picture of my database structure:</p>
  
  <p><img src="https://i.stack.imgur.com/4n3Rk.png" alt=""></p>