diff --git a/controller/edit-profile.php b/controller/edit-profile.php
index 357e311738a1019b408886bd0b458bb2b0868d9f..da8d0868836ee2ba47ad71f008da8bd1ac5999bb 100644
--- a/controller/edit-profile.php
+++ b/controller/edit-profile.php
@@ -25,18 +25,55 @@ if(!$_POST) {
 if(isset($_POST["submit"])) {
     $user = new User;
     $userid = $_GET['id'];
-    $name = $_POST['name'];
-    $phone = $_POST['phone'];
     $isDriver = 0;
-    if(isset($_POST['driver'])) {
-        if($_POST['driver'] == 'on') {
-          $isDriver = 1;
+    $image = "";
+    $name = "";
+    $phone = "";
+    $result = $user -> getUserById($userid);
+    while($row = mysqli_fetch_array($result)) {
+        $name = $row['name'];
+        $phone = $row['phone'];
+        $image = $row['image'];
+        $isDriver = $row['isDriver'];
+    }
+    if(isset($_POST['name'])) {
+        $name = $_POST['name'];
+    }
+    if(isset($_POST['phone'])) {
+        $phone = $_POST['phone'];
+    }
+    if(file_exists($_FILES["image-file"]["tmp_name"])) {
+        $targetDir = "../img/";
+        $targetFile = $targetDir . basename($_FILES["image-file"]["name"]);
+        $uploadOK = 1;
+        $imageFileType = pathinfo($targetFile,PATHINFO_EXTENSION);
+        $check = getimagesize($_FILES["image-file"]["tmp_name"]);
+        if($check !== false) {
+            $uploadOK = 1;
+        } else {
+            $uploadOK = 0;
+        }
+        if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
+            && $imageFileType != "gif" ) {
+            $uploadOk = 0;
+        }
+        if($uploadOK == 1) {
+            if (move_uploaded_file($_FILES["image-file"]["tmp_name"], $targetFile)) {
+                $image = basename($_FILES["image-file"]["name"]);
+            }
+        }
+        if($uploadOK == 0) {
+            echo 'no';
         }
     }
-    //if(isset(($_POST['image'])))
-    $image = $_POST['image-file'];
-    $user -> updateProfileById($userid,$name,$phone,$isDriver,$image);
+    if(isset($_POST['driver'])) {
+        $isDriver = 1;
+    } else {
+        $isDriver = 0;
+    }
+    $user->updateProfileById($userid, $name, $phone, $isDriver, $image);
     header('Location: ../view/edit-profile.php?id=' . $userid);
+
 }
 
 
diff --git a/js/edit-profile.js b/js/edit-profile.js
index d8b29eaf540789f0f925ce2db5f2e8099c4e9faf..ccd524e712447623a3d8baa8f2a2835d724f3bb5 100644
--- a/js/edit-profile.js
+++ b/js/edit-profile.js
@@ -33,7 +33,6 @@ function checkAllInput() {
         alert("Name must be 1-20 characters long!");
         return false;
     }
-
     //Check Phone
     var regex = /^08([0-9]){1,}$/;
     if(phone.value == "") {
diff --git a/js/register.js b/js/register.js
index 71bfdc4ec1f20abec805b7c68714fd2810b06420..1ee8fbe6cc903c41fb0aa1542f594680bcbfc247 100644
--- a/js/register.js
+++ b/js/register.js
@@ -102,42 +102,4 @@ function checkAllInput() {
         alert("Phone number must be valid");
         return false;
     }
-
-    // var name = document.forms["form"]["full-name"].value;
-    // if(name == "") {
-    //     alert("Your name field must be filled!");
-    //     return false;
-    // //Check username
-    // var username = document.forms["form"]["username"].value;
-    // if(username == "") {
-    //     alert("Username field must be filled!");
-    //     return false;
-    // /// /Check email
-    // var email = document.forms["form"]["email"].value;
-    // if(email == "") {
-    //     alert("Email field must be filled!");
-    //     return false;
-    // }
-}
-
-function checkName() {
-
-}
-
-function checkPassword() {
-    //Check Password
-    var password = document.forms["form"]["password"].value;
-    var confirmPassword = document.forms["form"]["confirm-password"].value;
-    if(password == "") {
-        alert("Password field must be filled!");
-        return false;
-    } else if(confirmPassword == "") {
-        alert("Confirm Password field must be filled!");
-        return false;
-    }
-}
-
-function checkPhone() {
-    //Check Phone
-    var phone = document.forms["form"]["phone"].value;
 }
\ No newline at end of file
diff --git a/view/edit-profile.php b/view/edit-profile.php
index df7b8af17e74d13b3e151a81c549469027bb26be..ffc32ccc0154b430eb599a5ad48fd6a5ba1c04a5 100644
--- a/view/edit-profile.php
+++ b/view/edit-profile.php
@@ -8,11 +8,11 @@
     </script>
     <script src="../js/edit-profile.js"></script>
 </head>
-<body onload="getUserProfile();">
+<body onload="getUserProfile();" onreset="getUserProfile()" onpageshow="getUserProfile()">
 <div class="container">
     <h1>EDIT PROFILE INFORMATION</h1>
-    <form action="../controller/edit-profile.php?id=<?php echo $_GET['id']?>"
-          method="post" id="form" name="editForm" onsubmit="checkAllInput()">
+    <form enctype="multipart/form-data" action="../controller/edit-profile.php?id=<?php echo $_GET['id']?>"
+          method="post" id="form" name="editForm" onsubmit="return checkAllInput()">
         <input type="hidden" id="userid" value="<?php echo $_GET['id'];?>">
         <div class="edit-image">
           <div class="div-profile-image">
@@ -22,7 +22,7 @@
             <label>Update profile picture</label>
             <br />
             <br />
-            <input type="file" name="image-file" value="browse.." id="image-file">
+            <input type="file" name="image-file" value="browse.." id="image-file" onsubmit="">
           </div>
         </div>
         <div>
@@ -46,7 +46,7 @@
         </div>
         <div>
           <div>
-            <a class="back" href="dashboard.php">BACK</a>
+            <a class="back" href="dashboard.php?id=<?php echo $_GET['id'];?>">BACK</a>
             <input type="submit" value="SAVE" class="save" name="submit">
           </div>
         </div>