<?php
if($_POST){
    include 'connect.php';
    try {
        $query = "INSERT INTO users SET username=:username, 
        first_name=:first_name, last_name=:last_name, 
        email=:email";
        $stmt = $con->prepare($query);
        $username = $_POST['username'];
        $first_name = $_POST['first_name'];
        $last_name = $_POST['last_name'];
        $email = $_POST['email'];
        $stmt->bindParam(':username', $username);
        $stmt->bindParam(':first_name', $first_name);
        $stmt->bindParam(':last_name', $last_name);
        $stmt->bindParam(':email', $email);
        if ($stmt->execute()) {
            echo json_encode(array('result'=>'success'));
        } else {
            echo json_encode(array('result'=>'fail'));
        }
    } catch(PDOException $exception) {
        die('ERROR: ' . $exception->getMessage());
    }
}
?>
I am using this to add users to my database. However, no matter what I type into my form it sets the username field to "root". It could also be my ts or html but at this point I was just wondering if anything looks wrong here.
 
    