title: How to add new fields in my registration form
body: <p>I want to add extra fields in my registration form like date of birth, city, country, and marital status. I am new to PHP and PDO.</p>
  
  <p>Here is my code:</p>
  
  <p><strong>PHP</strong>:</p>
  
  <pre><code>&lt;?php
  require 'core/init.php';
  $general-&gt;logged_in_protect();
  
  if (isset($_POST['submit'])) {
      if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email'])) {
          $errors[] = 'All fields are required.';
      } else {
          if ($users-&gt;user_exists($_POST['username']) === true) {
              $errors[] = 'That username already exists';
          }
          if (!ctype_alnum($_POST['username'])) {
              $errors[] = 'Please enter a username with only alphabets and numbers';
          }
  
          if (strlen($_POST['password']) &lt;6) {
              $errors[] = 'Your password must be atleast 6 characters';
          } else if (strlen($_POST['password']) &gt;18) {
              $errors[] = 'Your password cannot be more than 18 characters long';
          }
  
          if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
              $errors[] = 'Please enter a valid email address';
          } else if ($users-&gt;email_exists($_POST['email']) === true) {
              $errors[] = 'That email already exists.';
          }
      }
  
      if (empty($errors) === true) {
          $username = htmlentities($_POST['username']);
          $password = $_POST['password'];
          $email = htmlentities($_POST['email']);
          $users-&gt;register($username, $password, $email);
          header('Location: register.php?success');
          exit();
      }
  }
  </code></pre>
  
  <p><strong>HTML</strong>:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  
      &lt;head&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;link rel="stylesheet" type="text/css" href="css/style.css"&gt;
          &lt;title&gt;Register&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;div class="nav-bar" style="box-shadow:0 0 5px 0 rgba(0, 0, 0, 0.4);"&gt;
              &lt;?php include 'includes/menu.php'; ?&gt;
          &lt;/div&gt;
          &lt;!-- NAV BAR DIV closes here --&gt;
          &lt;div id="main-wrap" style="box-shadow:0 0 5px 0 rgba(0, 0, 0, 0.4);"&gt;
              &lt;div id="container"&gt;
                  &lt;h1&gt;Register&lt;/h1&gt;
  
                  &lt;?php if (isset($_GET['success']) &amp;&amp; empty($_GET['success'])) { echo 'Thank you for registering. Please check your email.'; } ?&gt;
                  &lt;form method="post" action=""&gt;
                      &lt;h4&gt;Username:&lt;/h4&gt;
                      &lt;input type="text" name="username" value="&lt;?php if (isset($_POST['username'])) echo htmlentities($_POST['username']); ?&gt;"&gt;
  
                      &lt;h4&gt;Password:&lt;/h4&gt;
                      &lt;input type="password" name="password" /&gt;
                      &lt;h4&gt;Email:&lt;/h4&gt;
  
                      &lt;input type="text" name="email" value="&lt;?php if (isset($_POST['email'])) echo htmlentities($_POST['email']); ?&gt;" /&gt;
  
                      &lt;br&gt;
                      &lt;input type="submit" name="submit" value="Register" /&gt;
                  &lt;/form&gt;
                  &lt;?php if (empty($errors) === false){ echo '&lt;p&gt;' . implode('&lt;/p&gt;&lt;p&gt;', $errors) . '&lt;/p&gt;'; } ?&gt;
              &lt;/div&gt;
              &lt;!-- Container DIV closes here --&gt;
          &lt;/div&gt;
          &lt;!-- Main Wrap DIV closes here --&gt;
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>How do I add the extra fields?</p>