title: Post Form Data To phpmyadmin Database
body: <p>I need to post data from a website (HTML5 based) to a database on PHPMyAdmin. I have the <em>database created as <code>sewcute</code></em> and <em>a table named <code>members</code></em>. I'm using XAMMP if that matters.</p>
  <p>In this code, I want to post data from a registration form to the <code>member</code> database.</p>
  <p><strong>The form:</strong></p>
  <pre><code> &lt;form id=&quot;maintext&quot; action=&quot;scdb.php&quot; method=&quot;post&quot;&gt;
              &lt;fieldset id=&quot;specialRequest&quot;&gt;
                  &lt;legend&gt;Registration Information&lt;/legend&gt;
                  &lt;label&gt;
                      &lt;input id=&quot;nameinput&quot; name=&quot;UserName&quot; placeholder=&quot;User Name&quot; type=&quot;text&quot;&gt;Create User Name
                  &lt;/label&gt;
                  &lt;label&gt;
                      &lt;input id=&quot;password&quot; name=&quot;password&quot; placeholder=&quot;Password&quot; type=&quot;text&quot;&gt;Password
                  &lt;/label&gt;
                  &lt;label for=&quot;nameinput&quot;&gt;
                      &lt;input id=&quot;nameinput&quot; name=&quot;FirstName&quot; placeholder=&quot;First Name&quot; type=&quot;text&quot;&gt;First Name
                  &lt;/label&gt;
                  &lt;label for=&quot;nameinput&quot;&gt;
                      &lt;input id=&quot;nameinput&quot; name=&quot;LastName&quot; placeholder=&quot;Last Name&quot; type=&quot;text&quot;&gt;Last Name
                  &lt;/label&gt;&lt;label&gt;
                      &lt;input id=&quot;addrinput&quot; name=&quot;address&quot; placeholder=&quot;Your Address&quot; type=&quot;text&quot;&gt;Street Address
                  &lt;/label&gt; &lt;label&gt;
                      &lt;input id=&quot;zipinput&quot; name=&quot;zip&quot; placeholder=&quot;12345&quot; type=&quot;text&quot;&gt;Zip Code
                  &lt;/label&gt;
                  &lt;label&gt;
                      &lt;input id=&quot;emailinput&quot; name=&quot;email&quot; placeholder=&quot;addr@example.com&quot; type=&quot;email&quot;&gt; Email
                  &lt;/label&gt;
                  &lt;label&gt;
                      &lt;input id=&quot;phoneinput&quot; name=&quot;phone&quot; placeholder=&quot;(123)456-7890&quot; type=&quot;text&quot;&gt;Phone
                  &lt;/label&gt;
                  &lt;label&gt;&lt;input id=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;&lt;/label&gt;
              &lt;/fieldset&gt;
              &lt;/form&gt;
  </code></pre>
  <p><strong>The PHP:</strong></p>
  <pre><code>    &lt;?php
  
      $host = &quot;localhost&quot;;
      $username = &quot;root&quot;;
      $password = &quot;&quot;;
      $database = &quot;sewcute&quot;;
      $dsn = (&quot;mysql:host=$localhost;dbname=$sewcute&quot;);
  
      TRY {
      $conn = new PDO( $dsn, $username, $password );
      $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
      if (isset($_POST['submit'])) {
          $username1 = $_POST['username1'];
          $password1 = $_POST['password1'];
          $firstname = $_POST['firstname'];
          $lastname = $_POST['lastname'];
  
  if (isset($_POST['UserID'])) {
      
      $id = $_POST['UserID'];
  
      $sql = &quot;UPDATE members SET&quot;
          . &quot;UserName=&quot;.$conn-&gt;quote($username1)
          . &quot;password=&quot;.$conn-&gt;quote($password1)
          . &quot;FirstName=&quot;.$conn-&gt;quote($firstname)
          . &quot;LastName&quot;.$conn-&gt;quote($lastname)
          . &quot; WHERE UserID = &quot;.$conn-&gt;quote($id);
      $members = $conn-&gt;query($sql);
  } else {
     
      $sql = &quot;INSERT INTO members(&quot;
          . &quot;UserName, password, FirstName, LastName&quot;
          . &quot; ) VALUES (&quot;
          . $conn-&gt;quote($username1).&quot;,&quot;
          . $conn-&gt;quote($password1).&quot;,&quot;
          . $conn-&gt;quote($firstname).&quot;,&quot;
          . $conn-&gt;quote($lastname).&quot;)&quot;;
          $members = $conn-&gt;query($sql);
          }
      } elseif (isset($_GET['ID'])) {
          $userEditDataRows = $conn-&gt;query('SELECT * FROM members WHERE UserID ='.$conn-    &gt;quote($_GET['UserID']));
          if (sizeof($userEditDataRows)&gt;0) {
      $row = $userEditDataRows[0];
      $username1 = $row['username1'];
      $password1 = $row['password'];
      $firstname = $row['firstname'];
      $lastname = $row['lastname'];
      $id = $_GET['UserID'];
          }
  
      }
  
  $table .= '&lt;/table&gt;';
  
      } catch (PDOException $e) {
       exit(&quot;Connection failed: &quot; . $e-&gt;getMessage());
      }
      ?&gt;
  </code></pre>
  <p><strong>And here is a picture of what the table structure looks like:</strong></p>
  <p><img src="https://i.stack.imgur.com/Xa5KT.png" alt="Database Structure" /></p>
  <p>I have all the website files in a folder that's on XAMPP. When I submit data from the form, I get a blank screen and nothing happens. I go to the database but nothing has been updated. Can anyone point me in the right direction? By the way, this is not a production website, it's just for class.</p>