-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage_account.php
52 lines (52 loc) · 1.71 KB
/
manage_account.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
session_start();
include('db_connect.php');
$qry = $conn->query("SELECT * FROM users where id = ".$_SESSION['login_id'])->fetch_array();
foreach($qry as $k => $val){
$meta[$k] = $val;
}
?>
<div class="container-fluid">
<form id="manage_user">
<div class="col-md-12">
<div class="form-group mb-2">
<label for="name" class="control-label">Name</label>
<input type="hidden" class="form-control" id="id" name="id" value='<?php echo isset($meta['id']) ? $meta['id'] : '' ?>' required="">
<input type="text" class="form-control" id="name" name="name" required="" value="<?php echo isset($meta['name']) ? $meta['name'] : '' ?>">
</div>
<div class="form-group mb-2">
<label for="username" class="control-label">User Name</label>
<input type="text" class="form-control" id="username" name="username" required value="<?php echo isset($meta['username']) ? $meta['username'] : '' ?>">
</div>
<div class="form-group mb-2">
<label for="password" class="control-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required value="<?php echo isset($meta['password']) ? $meta['password'] : '' ?>">
</div>
</div>
</form>
</div>
<script>
$('#manage_user').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'./update_account.php',
method:'POST',
data:$(this).serialize(),
error:err=>{
console.log(err)
end_load()
alert_toast('An error occured','danger');
},
success:function(resp){
if(resp == 1){
$('.modal').modal('hide')
alert_toast('Account successfully updated','success');
setTimeout(function(){
location.reload()
},500)
}
}
})
})
</script>