diff --git a/view/edit_biodata.php b/view/edit_biodata.php index 25b1a537b8b2dba21d9912e427d9b5a752f17c41..8290f78b7baa0ccb3bf45b27b36aa5d40f50052e 100644 --- a/view/edit_biodata.php +++ b/view/edit_biodata.php @@ -1,19 +1,15 @@ <!DOCTYPE html> <?php - var_dump($response); - echo "<br>"; - var_dump($data); - if ($response['code'] != 200) { - echo "<script> - alert('Error : ' + '{$response['code']}' + ' ' + '{$response['message']}'); - window.location.href='" . URLROOT . 'profile' . "'; - </script>"; - die; + if (isset($response)) { + if ($response['code'] != 200) { + alert("Error : " . $response['code'] . ' ' . $response['message']); + redirect(URLROOT . 'login'); + die; + } else if ($_SERVER['REQUEST_METHOD'] == "POST") { + redirect(URLROOT . 'profile'); + die; + } } - echo "<br>"; - var_dump((pathinfo($_FILES['image']['name']))['extension']); - var_dump($_POST); - ?> <html> <head> @@ -22,9 +18,12 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Edit Profile</title> <?php + include VIEW . "navBar.php"; + css("main.css"); css("edit_biodata.css"); - // js("upload.js"); + js("bootstrap.js"); js("edit.js"); + js("upload.js"); ?> <!-- <link rel="stylesheet" href="assets/css/edit_biodata.css"> <script src="assets/js/edit.js"></script> --> @@ -42,18 +41,18 @@ <form method="POST" action="" id="edit_form" enctype="multipart/form-data"> <input id="field_image_id" name="pic_id" hidden value="<?php echo $data["pic_id"]?>"> <tr> - <td><img class="prof_pic" src="<?php + <td><img id="prof_pic" class="prof_pic" src="<?php if(isset($data["pic_id"])) { - echo "ajax/image/get?id=". $data["pic_id"]; + path("ajax/image/get?id=". $data["pic_id"]); } else { - echo "assets/image/dummy.jpg"; + path("assets/image/dummy.jpg"); }?>" alt="Profile Picture"> </td> <td> Update profile picture <br> + <input type="text" id="filename" class="fieldname" readonly></div> <input id="field_data" name="image" type="file" accept="image/jpg|image/png" class="inputfile"/><label for="field_data">Browse...</label> - <!-- <input type="text" id="filename" class="fieldname" name="pic_id" value="<?php echo $data["pic_id"]?>"></div> --> <!-- <form action="ajax/image/set" method="POST" id="prof_pic_form"> <input id="field_data" name="data" type="file" accept="image/jpg|image/png" class="inputfile"/><label for="field_data">Browse...</label> </form> --> @@ -73,7 +72,7 @@ </tr> </form> <tr> - <td><button class="back" onclick="window.location.href = 'profile';">Cancel</button></td> + <td><button class="back" onclick="window.location.href = path('profile');">Cancel</button></td> <td align="right"><button class="save" id="save_button">Save </button></td> </tr> </table>