<div class="page-heading"> <h1>Add Branch Users</h1> </div> <div class="form-container"> <?php $branch = new branch(); $all_branch = $branch->get_branches(); $branch_user_role = new branch_user_role(); $all_branch_user_role = $branch_user_role->get_branch_user_role(); $branch_user = new branch_user(); $ID = isset($_GET['id']) ? $_GET['id'] : NULL; if (isset($_POST['add_branch_user'])) { // Update old record if (isset($ID)) { $results = $branch_user->update_branch_user($_POST, $ID); } else { // Insert new $results = $branch_user->insert_branch_user($_POST); } if ($results) { echo '<div class="alert alert-success" role="alert">'; echo isset($_GET['id']) ? 'Updated ' : 'Added '; echo 'branch user Sucessfully </div>'; } else { echo '<div class="alert alert-danger" role="alert"> Error </div>'; } } if (isset($ID)) { $branch_user_result = $branch_user->get_branch_user($ID); }