| 
<?php
 if (!isset($_POST['Action']))
 ShowFormAndDie();
 
 require('path/to/DatabaseAccess.Class.php');
 
 $DbAccess = new DatabaseAccess("yourHost", "dbName", "dbUser", "dbUserPassword");
 
 // Create a blank row of data to create an ID
 $numberOfRowsUpdated = $DbAccess->SimpleNon("INSERT INTO `UserAccounts` (`FirstName`) VALUES ('')");
 
 // Clean up anything in the $_POST that is not account data.
 unset($_POST['Action']);
 // Now add the new ID to the _POST array
 $_POST['ID'] = $DbAccess->LastInsertID();
 
 // Use the Post array to update the database
 $numberOfRowsUpdated = $DbAccess->UpdateTableViaArrayByID("UserAccounts", "ID", $_POST);
 
 
 
 function ShowFormAndDie() {
 // Note that the name of each input is the same as the Table Column names
 ?>
 
 <form method="post" action="./">
 <input type="hidden" name="Action" value="CreateUser" />
 <label for="FirstName">First Name</label>
 <input type="text" id="FirstName" name="FirstName" value="" />
 <label for="LastName" class="col-sm-2 control-label">Last Name</label>
 <input type="text" id="LastName" name="LastName" value="" />
 <label for="EMail">Email</label>
 <input type="email" id="EMail" name="EMail" value="" />
 <label for="ZipCode">ZipCode</label>
 <input type="text" id="ZipCode" name="ZipCode" value="" />
 <input type="submit">
 </form>
 
 <?php
 die();
 }
 |