diff --git a/app/views/addfact/index.php b/app/views/addfact/index.php
index 15bd91e1cb3673e5af383f88e3551f04bf0f356e..97238beb60a3ede8a1f4e30b4f12b9cae09fc807 100644
--- a/app/views/addfact/index.php
+++ b/app/views/addfact/index.php
@@ -9,43 +9,45 @@
     <title>Document</title>
 </head>
 <body>
-    <div class="content">
-        <div class="imagecontainer">
-            <img src="../../../assets/Nopict.png" alt="defaultProfPic" class="photoProfile">
-            <div class="editPhotoButton">
-                <label for="file" class="labelFile">Upload Photo</label>
-                <input type="file" name="file" id="file" class="file" accept="image/*,video/*">
+    <form action="../../../server/controller/auth/cms/AddFact.php" method="POST" enctype="multipart/form-data">
+        <div class="content">
+            <div class="imagecontainer">
+                <img src="../../../assets/Nopict.png" alt="defaultProfPic" class="photoProfile">
+                <div class="editPhotoButton">
+                    <label for="file" class="labelFile">Upload Photo</label>
+                    <input type="file" name="facts_file" id="file" class="file" accept="image/*,video/*">
+                </div>
             </div>
-        </div>
-        <div class="editcontainer">
-            <div class="factinformation">
-                <h2 class="facttitle">Fact Information</h2>
-                <div class="nametype">
-                    <div class="name-container">
-                        <div class="factname">
-                            <p class="labelname">Video File</p>
-                                <label for="file" class="labelFile">Upload Video</label>
-                                <input type="file" name="videofile" id="videofile" class="videofile" accept="image/*,video/*">
+            <div class="editcontainer">
+                <div class="factinformation">
+                    <h2 class="facttitle">Fact Information</h2>
+                    <div class="nametype">
+                        <div class="name-container">
+                            <div class="factname">
+                                <p class="labelname">Video File</p>
+                                    <label for="file" class="labelFile">Upload Video</label>
+                                    <input type="file" name="fact_file" id="videofile" class="videofile" accept="image/*,video/*">
+                            </div>
                         </div>
                     </div>
+                    <div class="videotitle">
+                        <p class="labeldescription">Video Title</p>
+                        <input type="text" placeholder="Title" class="inputtitle" id="edittitle" name="facttitle">
+                    </div>
+                    <div class="videotitle">
+                        <p class="labeldescription">Video Highlight</p>
+                        <input type="text" placeholder="Highlight" class="inputtitle" id="edithighlight" name="facthiglight">
+                    </div>
+                    <div class="factdescription">
+                        <p class="labeldescription">Fact Description</p>
+                        <textarea name="factdescription" id="factdescription"class="inputdescription" placeholder="Description"></textarea>
+                    </div>
+
                 </div>
-                <div class="videotitle">
-                    <p class="labeldescription">Video Title</p>
-                    <input type="text" placeholder="Title" class="inputtitle" id="edittitle" name="facttitle">
-                </div>
-                <div class="videotitle">
-                    <p class="labeldescription">Video Highlight</p>
-                    <input type="text" placeholder="Highlight" class="inputtitle" id="edithighlight" name="facthiglight">
-                </div>
-                <div class="factdescription">
-                    <p class="labeldescription">Fact Description</p>
-                    <textarea name="factdescription" id="factdescription"class="inputdescription" placeholder="Description"></textarea>
-                </div>
-                
-            </div>
 
-    
-            <button type="button" class="submitButton" name="submit" id="submitbtn">Save Change</button>
+                <button type="submit" class="submitButton" name="submit" >Save Change</button>
+            </div>
         </div>
+    </form>
 </body>
 </html>
\ No newline at end of file
diff --git a/app/views/editfact/index.php b/app/views/editfact/index.php
index 2dbf3c644fba37bbd5b461e5e795971a52da4ba2..28a4857a8a73753c9b9e39d9a9fdee9da8100341 100644
--- a/app/views/editfact/index.php
+++ b/app/views/editfact/index.php
@@ -42,6 +42,7 @@
                             <p class="labelname">Video File</p>
                                 <label for="file" class="labelFile" id="filename">Upload Video</label>
                                 <input type="file" name="videofile" id="videofile" class="videofile" accept="image/*,video/*">
+                                <button type="submit" class="updatebtn" id="updatebtn" name="updatebtn">Update</button>
                         </div>
                     </div>
                 </div>
diff --git a/public/js/addmeal.js b/public/js/addmeal.js
index 8fd301948b3741ee0f89393b66e8e7ddc3e552e8..25350add24b99959ed4fd4ef17d0970aceb2583c 100644
--- a/public/js/addmeal.js
+++ b/public/js/addmeal.js
@@ -50,7 +50,7 @@
         listItems.forEach(function(li, index) {
             const ingredients = li.querySelector('input[name^="ingredients"]');
             const information = li.querySelector('input[name^="information"]');
-            
+
             // Set POST variables dynamically using JavaScript
             ingredients.name = `item[${index}][ingredients]`;
             information.name = `item[${index}][information]`;
diff --git a/public/js/editfact.js b/public/js/editfact.js
index 8784a2792593f9c946aebccf8d7e17d96de6c8be..ba897e9cbe1cfa794a117e167482f94ad9aa8dca 100644
--- a/public/js/editfact.js
+++ b/public/js/editfact.js
@@ -8,7 +8,7 @@ function loadpage(id) {
         const startIndex = response.indexOf('[');
         const image = document.getElementById('imagevideo');
         const title = document.getElementById('edittitle');
-        const file = document.getElementById('filename')
+        const file = document.getElementById('filename');
         const description = document.getElementById('editdescription');
         const highlight = document.getElementById('edithighlight');
         const jsonStr = response.substring(startIndex);
@@ -56,4 +56,12 @@ function hideConfirmation() {
     const content = document.getElementById('content');
     confirmationBox.style.display = 'none';
     content.style.filter = 'none';
+}
+
+
+function updatelabel() {
+    const inputfile = document.getElementById('videofile');
+    const label = document.getElementById('filename');
+    console.log(inputfile.files)
+    label.textContent = inputfile.files[0].name;
 }
\ No newline at end of file
diff --git a/public/js/editmeal.js b/public/js/editmeal.js
index da2592d04bed1db914a6cb522751ec50e169c157..90366a198380112562224151aff41dff4a6386f3 100644
--- a/public/js/editmeal.js
+++ b/public/js/editmeal.js
@@ -14,8 +14,10 @@
         inputIngredients.type = "text";
         inputIngredients.placeholder = "Ingredients";
         inputIngredients.class = "form-control";
+        inputIngredients.name = "ingredients";
         inputInformation.type = "text";
         inputInformation.placeholder = "Information";
+        inputInformation.name = "information";
 
         // Set text and type for the delete button
         deleteBtn.textContent = "X";
@@ -36,6 +38,8 @@
         ingredientList.appendChild(listItem);
     }
 
+
+
     // Add a click event listener to the "Add Ingredients" button
     addIngredientBtn.addEventListener("click", createListItem);
 
@@ -70,6 +74,7 @@
             const titleInput = document.getElementById("title"); // Get the input element by its id
             titleInput.value = content[0][0]['title']; // Set the value
             descrition.value = content[0][0]['description'];
+            // type.value = content[0][0]['type'];
 
             for (let i = 0; i < content[1].length; i++) {
                 const ingredients = document.getElementById('ingredientList');
@@ -83,9 +88,11 @@
                 inputIngredients.placeholder = "Ingredients";
                 inputIngredients.class = "form-control";
                 inputIngredients.value = ingredient;
+                inputIngredients.name = "ingredients";
                 inputInformation.type = "text";
                 inputInformation.placeholder = "Information";
                 inputInformation.value = description;
+                inputInformation.name = "information";
                 li.appendChild(inputIngredients);
                 li.appendChild(inputInformation);
                 deleteBtn.textContent = "X";
@@ -110,6 +117,18 @@
             // console.log(content['title']);
         
         };
+
+        document.querySelector("form").addEventListener("submit", function(event) {
+            const listItems = document.querySelectorAll("#ingredientList li");
+            listItems.forEach(function(li, index) {
+                const ingredients = li.querySelector('input[name^="ingredients"]');
+                const information = li.querySelector('input[name^="information"]');
+
+                // Set POST variables dynamically using JavaScript
+                ingredients.name = `item[${index}][ingredients]`;
+                information.name = `item[${index}][information]`;
+            });
+        });
         
         xhttp.send(JSON.stringify({id : id}));
     }
\ No newline at end of file
diff --git a/server/controller/auth/cms/AddFact.php b/server/controller/auth/cms/AddFact.php
index 30f9cbd497e0bef21ef6db4f893eb57a6f37ca6e..cd7a6a135250b0ed8549eb3423c6b7a52566518a 100644
--- a/server/controller/auth/cms/AddFact.php
+++ b/server/controller/auth/cms/AddFact.php
@@ -5,6 +5,7 @@ require_once "../../../../server/handler/data/File.php";
 
 use data\File;
 
+$test = array();
 
 
 if(isset($_POST['submit'])) {
@@ -14,38 +15,54 @@ if(isset($_POST['submit'])) {
 
     $writeDirectory = "../../../../assets/content/";
 
-    if (!empty($_FILES['file']['name'])) {
-
-        $t = $_FILES['file']['name'];
-        echo "<script>console.log('$t')</script>";
-//        $file_name = $_FILES['file']['name'];
-//        $tmp_name = $_FILES['file']['tmp_name'];
-//        $extension = pathinfo($file_name, PATHINFO_EXTENSION);
-//        $file_up_name = time() . "." . $extension;
-//        move_uploaded_file($tmp_name, $targetDirectory . $file_up_name);
-//
-//        $id_file_photo = $file->Insert($file_name,'../../assets/content/'.$file_up_name,'photo');
-    }
-
-    if (!empty($_FILES['videofile']['name'])) {
-        if (!empty($_FILES['videofile'])){
-            $t = $_FILES['videofile']['name'];
-
-            echo "<script>console.log('$t')</script>";
-        }
-
-//        $file_name = $_FILES['file']['name'];
-//        $tmp_name = $_FILES['file']['tmp_name'];
-//        $extension = pathinfo($file_name, PATHINFO_EXTENSION);
-//        $file_up_name = time() . "." . $extension;
-//        move_uploaded_file($tmp_name, $targetDirectory . $file_up_name);
-//
-//        $id_file_photo = $file->Insert($file_name,'../../assets/content/'.$file_up_name,'photo');
-    }
-
 
 
-//    echo "<script>window.location.href='/?cms'</script>";
 
 
 }
+//if (!empty($_FILES['facts_file']['name'])){
+//
+////    $fileCount = count($_FILES['facts_file']['name']);
+//    $test[] = $_FILES['facts_file'];
+//
+//    $j = json_encode($_FILES);
+//    echo "<script>console.log('$j')</script>";
+//
+////        for ($i = 0; $i < $fileCount; $i++) {
+////            $fileName = $_FILES['file']['name'][$i];
+////            $fileTmpName = $_FILES['file']['tmp_name'][$i];
+////            $fileType = $_FILES['file']['type'][$i];
+////            $fileSize = $_FILES['file']['size'][$i];
+////            $fileError = $_FILES['file']['error'][$i];
+////
+////            // You can process the uploaded file(s) here
+////            // For example, move them to a specific directory
+////            $uploadDir = 'your_upload_directory/';
+////            $targetFilePath = $uploadDir . $fileName;
+////
+////            echo "<script>console.log('$fileName')</script>";
+////        }
+//}
+//if (!empty($_FILES['fact_file']['name'])){
+//
+//    $test[] = $_FILES['fact_file'];
+////    $fileCount = count($_FILES['fact_file']['name']);
+//
+//    $j = json_encode($_FILES);
+//    echo "<script>console.log('$j')</script>";
+//
+////        for ($i = 0; $i < $fileCount; $i++) {
+////            $fileName = $_FILES['file']['name'][$i];
+////            $fileTmpName = $_FILES['file']['tmp_name'][$i];
+////            $fileType = $_FILES['file']['type'][$i];
+////            $fileSize = $_FILES['file']['size'][$i];
+////            $fileError = $_FILES['file']['error'][$i];
+////
+////            // You can process the uploaded file(s) here
+////            // For example, move them to a specific directory
+////            $uploadDir = 'your_upload_directory/';
+////            $targetFilePath = $uploadDir . $fileName;
+////
+////            echo "<script>console.log('$fileName')</script>";
+////        }
+//}
diff --git a/server/controller/auth/cms/AddMeal.php b/server/controller/auth/cms/AddMeal.php
index 77d37b9060c3abf0c7981ead7ea6f8e4270c46b5..25714d27c42539a46909c649f6a24ae0d34e9094 100644
--- a/server/controller/auth/cms/AddMeal.php
+++ b/server/controller/auth/cms/AddMeal.php
@@ -62,7 +62,7 @@ if(isset($_POST['submit'])) {
         }
     }
 
-    echo "<script>window.location.href='/?cms'</script>";
+//    echo "<script>window.location.href='/?cms'</script>";
 
 
 }
diff --git a/server/controller/auth/cms/EditMeal.php b/server/controller/auth/cms/EditMeal.php
index 35579f3a77cf7d0afaff6bf1146862a49181342e..a69bdb3821048dd34b52984411678c2bd5dd4202 100644
--- a/server/controller/auth/cms/EditMeal.php
+++ b/server/controller/auth/cms/EditMeal.php
@@ -20,7 +20,6 @@ if (isset($_POST['submit'])){
     $ingredients = new Ingredients();
 
     $get_meals = $meal->FindById($id)[0];
-    $get_ingredients = $ingredients->FindByMeals($id);
     $get_nutrition = $ingredients->FindByMeals($id);
     $get_file = $file->FindById($get_meals['id_photo']);
 
@@ -34,7 +33,7 @@ if (isset($_POST['submit'])){
         $file_up_name = time() . "." . $extension;
         move_uploaded_file($tmp_name, $targetDirectory . $file_up_name);
 
-        $file->Update($file->FindById($get_meals['id_photo']),$file_name,'../../assets/meals/'.$file_up_name,'photo');
+        $file->Update($get_meals['id_photo'],$file_name,'../../assets/meals/'.$file_up_name,'photo');
     }
     if (isset($_POST['mealname'])){
         $get_meals['title'] = $_POST['mealname'];
@@ -65,6 +64,8 @@ if (isset($_POST['submit'])){
     if(isset($_POST['item'])) {
         $ingredients->DeleteByIdMeals($id);
         $items = $_POST['item'];
+        $test = json_encode($items);
+        echo "<script>console.log('masuk sini $test')</script>";
         foreach ($items as $index => $itemData) {
             $ing = $itemData['ingredients'];
             $info = $itemData['information'];
diff --git a/server/di/InitialData.php b/server/di/InitialData.php
index 7f87b7de49e5d00975b34c3e84d8d0c3607b7f20..fd988a72e10e03244e91821c50cebdd9f720a658 100644
--- a/server/di/InitialData.php
+++ b/server/di/InitialData.php
@@ -152,7 +152,7 @@ class InitialData
                 'highlight' => 'Caesar salad adalah olahan salad sayur yang sangat populer. Jangan kira resep makanan ini ditemukan saat Julius Caesar berkuasa. Nama caesar salad diambil dari Caesar Cardini, chef dan pengusaha restoran yang menemukan racikannya.',
                 'description' => "Cara Membuat Crouton:\n\n
                                   Oles tipis-tipis permukaan roti dengan margarin, kemudian potong dadu.Panaskan minyak goreng, kemudian tumis bawang putih hingga harum. Masukkan potongan roti, lalu aduk rata hingga berwarna agak kecokelatan. Setelah itu angkat crouton dan sisihkan terlebih dahulu.Cara Membuat Salad Dressing:Kocok kuning telur hingga berwarna pucat. Tuang minyak zaitun sedikit demi sedikit sambil terus diaduk hingga kental.Tuangkan air lemon, garam, merica, gula pasir, capers, dan anchovy. Aduk rata, kemudian sisihkan terlebih dahulu.Penyajian:Aduk romaine lettuce dengan saus secukupnya saja.Taburi crouton, daging asap, dan telur rebus. Setelah itu taburi dengan keju parmesan parut.Sajikan caesar salad selagi romain lettuce masih segar dan renyah.",
-                'type' => 'breakfast',
+                'type' => 'Breakfast',
                 'calorie' => 77,
                 'id_file' =>8,
                 'created_at' => $curr,
@@ -164,7 +164,7 @@ class InitialData
                 'description' => "Cara Membuat Summer Roll Vietnam:\n\n
                                   Rebus atau rendam soun dalam air panas sampai lunak. Kemudian tiriskan airnya dan tuangi sedikit minyak wijen agar tidak menggumpal. Iris memanjang timun dan lettuce. Avokad dan bawang perai diiris tipis dengan potongan menyerong. Kacang tanah digerus kasar. Rebus udang yang sudah dikupas dan dibuang ekor serta kepalanya selama 1-2 menit. Kemudian tiriskan airnya dan rendam dalam larutan air, cuka, garam, dan arak masak. Setelah itu belah menjadi 2 bagian dan sisihkan. Rebus paha ayam di dalam air yang sudah dibubuhi garam. Setelah itu iris-iris seukuran satu suapan. Basahi rice paper dengan air panas agar lunak. Jangan sampai berkerut dan menempel. Ambil 2 lembar rice paper, kemudian tumpuk agar summer rolls tidak mudah sobek. Alasi dengan perilla, kemudian letakkan lettuce, avokad, ayam, soun, bawang perai, dan timun di satu sisi. Taburi kacang tanah,kemudian gulung rapi seperti amplop. Sebelum 2 gulungan terakhir, letakkan udang yang sudah dibelah 2 dengan sisi luar menghadap bawah.
                                   Sajikan summer rolls dalam keadaan utuh atau dipotong-potong dengan saus asam manis.",
-                'type' => 'breakfast',
+                'type' => 'Breakfast',
                 'calorie' => 74,
                 'id_file' =>10,
                 'created_at' => $curr,
@@ -175,7 +175,7 @@ class InitialData
                 'highlight' => 'Som tum adalah salad pepaya muda dari Thailand. Rasanya asam, manis, gurih, dan pedas. Segarnya bumbu dengan citarasa asam, kecap ikan, dan kacang tanah membuat rasanya semakin istimewa.',
                 'description' => "Cara Membuat Som Tum:\n\n
                                   Siapkan ulekan dan semua bahan. Ulek cabai rawit dan bawang putih bersamaan. Tambahkan gula pasir, kacang panjang, dan tomat. Aduk perlahan hingga rata. Peras lemon dan aduk rata airnya bersama kecap ikan. Tambahkan irisan pepaya, wortel, ebi, dan kacang ke dalam campuran air lemon dan kecap ikan. Aduk hingga rata. Tunggu hingga bumbu meresap ke dalam pepaya dan wortel. Setelah itu, hidangkan.",
-                'type' => 'breakfast',
+                'type' => 'Breakfast',
                 'calorie' => 73,
                 'id_file' =>11,
                 'created_at' => $curr,