<form method="POST">
<table>
<tr>
<td>Name:</td><td><input name="username" /></td>
</tr>
<tr><td colspan="2" align="center"><input type="submit" value="Add User"/></td></tr>
</table>
</form>
<?php 
include_once './db_functions.php';
//Create Object for DatabaseFunction class
if (isset($_POST["username"]) && !empty($_POST["username"])) {
    $db = new DatabaseFunction();
    //Store User into MySQL DB
    $uname = $_POST["username"];
    $res = $db->storeUser($uname);
    //Based on insertion, create JSON response
    if ($res) {
        ?>
         <div id="msg">Insertion successful</div>
    <?php 
    } else {
        ?>
         <div id="msg">Insertion failed</div>
    <?php 
    }
} else {
    ?>
 <div id="msg">Please enter name and submit</div> 
<?php 
}