diff --git a/app/controllers/admin.php b/app/controllers/admin.php
index f093c00f7e3813c0eeb7c7e91d7d7fd9523973b0..f5d11a9ed26977424ceb459ab81b3a8c84ab8912 100644
--- a/app/controllers/admin.php
+++ b/app/controllers/admin.php
@@ -61,21 +61,21 @@ class Admin extends Controller {
                 $selectedCategory = $_POST["pickedCategory"];
                 $newContent = $_POST["addContent"];
 
-                $data['book'] = $this->model('BookModel')->getAllBook();
+                $data['book'] = $this->model('BookModel')->getAllBookAdmin();
+                $data['author'] = $this->model('AuthorModel')->getAuthor();
                 $array = array_column($data['book'], "title");
 
                 // Cek stringnya kosong ato g
-                if(empty($newTitle) || empty($newContent)){
-                    $this->view('admin/useradmin', $data);
+                if(empty($newTitle) || empty($newContent) || ( empty ($newTitle) && empty($newContent) )){
+                    $this->view('admin/bookadmin', $data);
                 }
                 // Cek exist ato g usernya
                 if (!in_array($newTitle, $array, true)){
-                    $this->model('UserModel')->insertUser($newTitle, $newContent, $selectedAuthor, $selectedCategory);
+                    $this->model('BookModel')->insertBook($newTitle, $newContent, $selectedAuthor, $selectedCategory);
                 }
                 
             }
-            $data['book'] = $this->model('BookModel')->getAllBook();
-            $this->view('admin/useradmin', $data);
+            $this->view('admin/bookadmin', $data);
         } else {
             $this->view('error/404');
         }
@@ -121,17 +121,17 @@ class Admin extends Controller {
                 // Cek string kosong ato ga
                 if(empty($newTitle)){
                     $data['book'] = $this->model('BookModel')->getAllBookAdmin();
-                    $data['author'] = $this->model('BookModel')->getAuthor();
+                    $data['author'] = $this->model('AuthorModel')->getAuthor();
                     $this->view('admin/bookadmin', $data);
                 }
 
-                // Cek title udah ada atau belum
-                if(!in_array($newTitle, $array, true)){
+                // Cek title udah ada atau belum, atau emang gk diganti
+                if(!in_array($newTitle, $array, true) || $newTitle === $oldTitle){
                     $this->model('BookModel')->updateBook($oldTitle, $newTitle, $selectedAuthor, $newContent, $selectedCategory);
                 }
 
                 $data['book'] = $this->model('BookModel')->getAllBookAdmin();
-                $data['author'] = $this->model('BookModel')->getAuthor();
+                $data['author'] = $this->model('AuthorModel')->getAuthor();
                 $this->view('admin/bookadmin', $data);
 
             }
@@ -145,7 +145,7 @@ class Admin extends Controller {
                 // Dapetin nilai dari input formnye ya
                 $newUsername = $_POST['newUsername'];
                 $newPassword = $_POST['newPassword'];
-                $oldUsername = $_POST['username'];
+                $userId = $_POST['userid'];
                 $data['user'] = $this->model('UserModel')->getAllUser();
 
                 // Bikin kolom array list username buat pengecekkan
@@ -157,7 +157,7 @@ class Admin extends Controller {
                 }
                 // Janlups, cek dulu ada di db ato g ye gan
                 if (!in_array($newUsername, $array, true)){
-                   $this->model('UserModel')->updateUser($oldUsername, $newUsername, $newPassword);
+                   $this->model('UserModel')->updateUser($userId, $newUsername, $newPassword);
                 }
 
                 
diff --git a/app/models/BookModel.php b/app/models/BookModel.php
index 66257c53c4809519525d870c4e27aac6a573503d..91a91463fbdceb5852593a1b5f4733d83935d998 100644
--- a/app/models/BookModel.php
+++ b/app/models/BookModel.php
@@ -40,11 +40,13 @@ class BookModel
     }
 
     public function insertBook($newTitle, $newContent, $pickedAuthor, $pickedCategory){
-        $this->database->query('INSERT IGNORE INTO book (id, title, content, author_id, audio_path, image_path, category) VALUES (NULL, :newTitle, :newContent, (SELECT id FROM author WHERE name = :pickedAuthor), :newAudio, :newImage, :pickedCategory)');
+        $this->database->query('INSERT IGNORE INTO book (id, title, content, author_id, audio_path, image_path, category) VALUES (NULL, :newTitle, :newContent, (SELECT id FROM author WHERE author.name = :pickedAuthor), :newAudio, :newImage, :pickedCategory)');
+        $newAudio = "audioex.mp3";
+        $newImage = "imageex.png";
         $this->database->bind('newTitle', $newTitle);
         $this->database->bind('newContent', $newContent);
-        $this->database->bind('newAudio', 'audioex.mp3');
-        $this->database->bind('newImage', 'imageex.png');
+        $this->database->bind('newAudio', $newAudio);
+        $this->database->bind('newImage', $newImage);
         $this->database->bind('pickedAuthor', $pickedAuthor);
         $this->database->bind('pickedCategory', $pickedCategory);
         $this->database->execute();
diff --git a/app/models/UserModel.php b/app/models/UserModel.php
index 47951f025996ceadbcf31836c8cef984240e30b7..64eea7e8423bd2af9daa5a947efaa0d84451f569 100644
--- a/app/models/UserModel.php
+++ b/app/models/UserModel.php
@@ -30,11 +30,11 @@ class UserModel
         return $this->database->single();
     }
 
-    public function updateUser($currentUsername, $newUsername, $newPassword){
-        $this->database->query('UPDATE ' . $this->table . ' SET username = :newUsername, password = :newPassword WHERE username = :currentUsername');
+    public function updateUser($userId, $newUsername, $newPassword){
+        $this->database->query('UPDATE ' . $this->table . ' SET username = :newUsername, password = :newPassword WHERE id = :userId');
         $this->database->bind('newUsername', $newUsername);
         $this->database->bind('newPassword', $newPassword); // Hash the new password
-        $this->database->bind('currentUsername', $currentUsername);
+        $this->database->bind('userId', $userId);
         $this->database->execute();
     }
 
diff --git a/app/views/admin/bookadmin.php b/app/views/admin/bookadmin.php
index 1cd9e1d9978fe1d381a77e38b9f100c522aac25f..b823bd9855f34cafa7ee90683e277092de9c68bd 100644
--- a/app/views/admin/bookadmin.php
+++ b/app/views/admin/bookadmin.php
@@ -63,6 +63,7 @@
                             <div id="editpopup" class="edit-popup">
                                 <form id="editForm" method="post" action='<?php echo BASEURL; ?>/admin/editBook'>
                                 <input type="hidden" name="oldTitle" value="<?php echo $title; ?>">
+                                <input type="hidden" name="bookid" value="<?php echo $id; ?>">
                                     <div class="horizontal-component">
                                         <div class="title-input">
                                             <input type="text" id='title' name="newTitle" placeholder="Enter new title..." class="input-text">
@@ -111,37 +112,38 @@
             </table>
         </div>
         <div class="add-popup" id="addpopup">
-            <div class="horizontal-component">
-                <div class="title-input" id="titleadd">
-                    <input type="text" id='title' name="addTitle" placeholder="Add title..." class="input-text">
+            <form id="addForm" method="post" action='<?php echo BASEURL; ?>/admin/addBook'>
+                <div class="horizontal-component">
+                    <div class="title-input" id="titleadd">
+                        <input type="text" id='titleadd' name="addTitle" placeholder="Add title..." class="input-text">
+                    </div>
+                    <select class="author-input" id="authoradd" name="pickedAuthor">
+                        <?php foreach ($data['author'] as $item):?>
+                            <option> <?php echo $item["name"];?> </option>;
+                        <?php endforeach;?>
+                    </select>
+                    <select class="category-input" id="categoryadd" name="pickedCategory">
+                        <option>Category A</option>
+                        <option>Category B</option>
+                        <option>Category C</option>
+                        <option>Category D</option>
+                        <option>Category E</option>
+                    </select>
                 </div>
-                <select class="author-input" id="authoradd" name="pickedAuthor">
-                    <option>Select Author</option>
-                    <?php foreach ($data['author'] as $item):?>
-                        <option> <?php echo $item["name"];?> </option>;
-                    <?php endforeach;?>
-                </select>
-                <select class="category-input" id="categoryadd" name="pickedCategory">
-                    <option>Category A</option>
-                    <option>Category B</option>
-                    <option>Category C</option>
-                    <option>Category D</option>
-                    <option>Category E</option>
-                </select>
-            </div>
-            <div class="content-input">
-                <input type="text" class="input-text" id="contentadd" name="addContent" type="text" placeholder="Add content.." name="search">
-            </div>
-            
-            <div class="horizontal-component">
-                <input type="file" id="fileInputAudioAdd" name="addAudio" ?id?accept="audio/mp3">
-                <label for="fileInputAudioAdd" class="audio-input">Upload Audio</label>
-                <input type="file" id="fileInputPictureAdd" name="addImage" accept="image/png">
-                <label for="fileInputPictureAdd" class="picture-input">Upload Picture</label>
-            </div>
+                <div class="content-input">
+                    <input type="text" class="input-text" id="contentadd" name="addContent" type="text" placeholder="Add content.." name="search">
+                </div>
+                
+                <div class="horizontal-component">
+                    <input type="file" id="fileInputAudioAdd" name="addAudio" accept="audio/mp3">
+                    <label for="fileInputAudioAdd" class="audio-input">Upload Audio</label>
+                    <input type="file" id="fileInputPictureAdd" name="addImage" accept="image/png">
+                    <label for="fileInputPictureAdd" class="picture-input">Upload Picture</label>
+                </div>
+            </form>
             <div class="add-submission">
-                <button class="submit-button" id="add-submit-button">Submit</button>
-                <button class="cancel-button" onclick=closeAddPopup()>Cancel</button>
+                <button class="submit-button" onclick="submitAddForm()">Submit</button>
+                <button class="cancel-button" onclick="closeAddPopup()">Cancel</button>
             </div>
         </div>
 
diff --git a/app/views/admin/useradmin.php b/app/views/admin/useradmin.php
index 8bf938011b1a0c99c2b37465881aa1fa7039e04b..3ed1edd7235e38f78e4f57a87d31d74ba4090ddd 100644
--- a/app/views/admin/useradmin.php
+++ b/app/views/admin/useradmin.php
@@ -52,6 +52,7 @@
                             <div class="edit-popup" id="editpopup">
                                 <form id="editForm" method="post" action='<?php echo BASEURL; ?>/admin/editUser'>
                                     <input type="hidden" name="username" value="<?php echo $username; ?>">
+                                    <input type="hidden" name="userid" value="<?php echo $id; ?>">
                                     <div class="add-input">
                                         <input type="text" id="username" name="newUsername" placeholder="Enter new username.." required>
                                     </div>
diff --git a/public/js/bookadmin.js b/public/js/bookadmin.js
index 9d683080b0beb5dff9b79c650243ebb5e6273a23..ddc0f2067a5daa9528033915f47c8e8bb2f6f356 100644
--- a/public/js/bookadmin.js
+++ b/public/js/bookadmin.js
@@ -5,10 +5,14 @@ const title = document.getElementById("title");
 const content = document.getElementById("content");
 const author = document.getElementById("author");
 const category =document.getElementById("category");
+const titleadd = document.getElementById("titleadd");
+const categoryadd = document.getElementById("categoryadd");
 let ol = document.getElementById("overlay");
 
 
 function openAddPopup(){
+    titleadd='';
+    categoryadd='';
     addpopup.classList.add("open-add-popup");
     ol.classList.add("open-overlay");
 }
@@ -44,6 +48,11 @@ function submitEditForm(){
     form.submit();
 }
 
+function submitAddForm(){
+    const form = document.getElementById("addForm");
+    form.submit();
+}
+
 function deletebook(){
     deletepopup.classList.add("open-delete-popup");
     ol.classList.add("open-overlay");
diff --git a/public/style/bookadmin.css b/public/style/bookadmin.css
index 6f1fba8563cef029c247f6dba27315051087a015..bf175588f620bad8156c12945ffb39a7a5ca61ce 100644
--- a/public/style/bookadmin.css
+++ b/public/style/bookadmin.css
@@ -164,6 +164,7 @@ body {
     margin-left: 30%;
     margin-top:5%;
     width:18%;
+    z-index: 13;
 }
 
 .cancel-button {