Issue with registration Failing in PHP andMySQL
<p>so I've been trying to create registration page, however everytime I try to register a user, it fails.</p>

<p>Here's the PHP page:</p>

<pre><code>&lt;?php

require 'databaseconnect.php';
if(!empty($_POST['username']) &amp;&amp; !empty($_POST['password'])):

    $sql = "INSERT INTO Technichians (username, password) VALUES (:username, :password)";
    $stmt = $conn-&gt;prepare($sql);

    $stmt-&gt;bindParam(':username', $_POST['username']);
    $stmt-&gt;bindParam(':password', $_POST['password']);

    if( $stmt-&gt;execute() ):
        die('success');
    else:
        die('fail');
    endif;

endif;
?&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;!-- TypeKit Fonts --&gt;

                &lt;!-- JQuery JS --&gt;
        &lt;script src="//code.jquery.com/jquery-1.11.3.min.js"&gt;&lt;/script&gt;
        &lt;script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"&gt;&lt;/script&gt;

        &lt;!-- CSS Files --&gt;
        &lt;link rel = "stylesheet" href="CSS/CSS_Main.css" type = "text/css"&gt;
        &lt;link rel = "stylesheet" href="CSS/CSS_Index.css" type = "text/css"&gt;


        &lt;!-- Latest compiled and minified CSS --&gt;
        &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"&gt;

        &lt;!-- Optional theme --&gt;
        &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"&gt;

        &lt;!-- Latest compiled and minified JavaScript --&gt;
        &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"&gt;&lt;/script&gt;  



        &lt;!-- Font Awesome for Icons --&gt;
        &lt;link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"&gt;

        &lt;!-- TypeKit Fonts --&gt;
        &lt;script src="//use.typekit.net/umi3ujh.js"&gt;&lt;/script&gt;
        &lt;script&gt;try{Typekit.load();}catch(e){}&lt;/script&gt;
        &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;

        &lt;title&gt;SWAT Technician Registration&lt;/title&gt;
        &lt;link rel="ICON" href="CSS/images/favicon.ico" type="image/ico" /&gt;

    &lt;/head&gt;
    &lt;body&gt;
        &lt;div class = "container_main"&gt;

            &lt;a name="top"&gt;&lt;/a&gt;
            &lt;div class = "containerDEF"&gt;
            &lt;center&gt;&lt;img class = "fixed  loginImg" src = "CSS/images/SWAT_logo.png" alt = "DesignLogo" width = "300" height="300px"&gt;&lt;/center&gt;
            &lt;form action = "registerswat.php" method = "POST"&gt;
                &lt;div class="input-group inputLogIn" id = "UsernameInput"&gt;
                            &lt;span class="input-group-addon" id="basic-addon1"&gt;Username:&lt;/span&gt;
                            &lt;input type="text" class="form-control" placeholder="ex. mPond" aria-describedby="basic-addon1" name = "username"&gt;
                        &lt;/div&gt;
                &lt;div class="input-group inputLogIn" id = "UsernameInput"&gt;
                            &lt;span class="input-group-addon" id="basic-addon1"&gt;Registration Pin:&lt;/span&gt;
                            &lt;input type="password" class="form-control" placeholder="******" aria-describedby="basic-addon1" name = "pin"&gt;
                        &lt;/div&gt;
                        &lt;div class="input-group inputLogin" id = "PasswordInput"&gt;
                            &lt;span class="input-group-addon" id="basic-addon1"&gt;Password:&lt;/span&gt;
                            &lt;input type="password" class="form-control" placeholder="ex. HelloSweetie" aria-describedby="basic-addon1" name = "password"&gt;
                        &lt;/div&gt;
                        &lt;div class="input-group inputLogin" id = "PasswordInput"&gt;
                            &lt;span class="input-group-addon" id="basic-addon1"&gt; Confrim Password:&lt;/span&gt;
                            &lt;input type="password" class="form-control" placeholder="ex. HelloSweetie" aria-describedby="basic-addon1" name = "confirmPassword"&gt;
                        &lt;/div&gt;
                        &lt;div class="input-group inputLogin" id = "PreferredName"&gt;
                            &lt;span class="input-group-addon" id="basic-addon1"&gt; Preferred Name:&lt;/span&gt;
                            &lt;input type="text" class="form-control" placeholder="ex. River" aria-describedby="basic-addon1" name = "preferredName"&gt;
                        &lt;/div&gt;
                    &lt;center&gt;&lt;input type = "submit" class = " submitButton" name = "Login" value = "Register"&gt;&lt;/center&gt;
            &lt;/form&gt;
                &lt;center&gt;&lt;p&gt;Didn't mean to be here? Go &lt;a href = "index.html"&gt;Back&lt;/a&gt;.&lt;/p&gt;
                        &lt;p&gt;Just want to login? &lt;a href = "swatlogin.php"&gt;Login Here&lt;/a&gt;. &lt;/p&gt;
                &lt;/center&gt;
        &lt;/div&gt;

            &lt;div class = "Footer  bottom"&gt;
                &lt;p&gt;SWAT Team 2016&lt;/p&gt;
                &lt;a class ="link" href = "contact.html"&gt;Contact&lt;/a&gt;
            &lt;/div&gt;




        &lt;/div&gt;
        &lt;script src = "Scripts/Script_Main.js"&gt;&lt;/script&gt;

    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>And Here's the required databaseconnect.php:</p>

<pre><code>&lt;?php
$server = 'localhost';
$username = 'SWATAdmin';
$password = 'SWAT2016DBAccess';
$database = 'SWATDatabase';

try{
    $conn = new PDO("mysql:host=$server;dbname=$database;", $username, $password);
} catch(PDOException $e){
    die("Connection failed: " . $e-&gt;getMessage());
}
?&gt;
</code></pre>

<p>I have truly no idea as to what's wrong. I built in an if statement to see if it failed or succeeded, and it continues to fail and the username does not end up in the database. Any help would be much appreciated!</p>