-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_profile.php
74 lines (64 loc) · 2.32 KB
/
update_profile.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
include("header.php");
include('connection.php');
$sel=mysqli_query($con,"SELECT * FROM `user` WHERE `id`='$_SESSION[uid]'");
$row=mysqli_fetch_array($sel);
?>
<a href="logout.php">a</a>
<!-- Service Start -->
<div class="container-fluid py-5">
<div class="container pt-5 pb-3">
<div class="text-center mb-3 pb-3">
<h1>Profile</h1>
</div>
<div class="row">
<div class="card-body rounded-bottom bg-white p-5">
<form method="POST" enctype="multipart/form-data">
<div class="form-group">
<input type="text" class="form-control p-4" name="name" value="<?php echo $row['name']; ?>" placeholder="Name" required="required" />
</div>
<div class="form-group">
<input type="text" class="form-control p-4" name="phone" value="<?php echo $row['phone']; ?>" placeholder="Phone" required="required" />
</div>
<div class="form-group">
<input type="email" class="form-control p-4" name="email" value="<?php echo $row['email']; ?>" placeholder="Email" required="required" />
</div>
<div class="form-group">
<input type="text" class="form-control p-4" name="password" value="<?php echo $row['password']; ?>" placeholder="Password" required="required" />
</div>
<div class="form-group">
<input type="file" class="form-control p-4" name="images" value="<?php echo $row['image']; ?>" placeholder="Password" required="required" />
</div>
<div>
<input class="btn btn-primary btn-block py-3" type="submit" name="submit1" value="Update Profile">
</div>
</form>
</div>
</div>
<?php
if(isset($_POST['submit1']))
{
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$pwd=$_POST['password'];
if($_FILES['images']['name']){
move_uploaded_file($_FILES['images']['tmp_name'], "uploads/".$_FILES['images']['name']);
$img=$_FILES['images']['name'];
//echo $img;
}
$upd="update user set name='$name',phone='$phone',email='$email',password='$pwd',image='$img' where id='$_SESSION[uid]'";
echo $upd;
mysqli_query($con,$upd);
//header('location:profile.php');
echo '<script>alert("Profile Updated!")
window.location="profile.php";
</script>';
}
?>
</div>
</div>
<!-- Service End -->
<?php
include("footer.php");
?>