-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuser-profile.php
77 lines (75 loc) · 3.38 KB
/
user-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
75
76
77
<?php
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if (strlen($_SESSION['sessionid']==0))
{
header('location:logout.php');
} else
{
if(isset($_POST['change_info']))
{
$userid=$_SESSION['sessionid'];
$fullname=$_POST['fullname'];
$email=$_POST['email'];
$mobno=$_POST['phone'];
$username=$_POST['username'];
$idnum=$_POST['idnumber'];
$query=mysqli_query($con, "UPDATE tbluser SET FullName ='$fullname', MobileNumber='$mobno', Email='$email',Username='$username',ID_Number='$idnum' WHERE ID='$userid'");
if ($query) {
$msg="User profile has been updated.";
}
else
{
$msg="Something Went Wrong. Please try again.";
}
}
?>
<?php include 'includes/header.php';?>
<div class="main-content">
<div class="title">
User Profile
</div>
<div class="main">
<div class="form-container">
<p style="font-size:16px; color:green" align="center"> <?php if($msg){ echo $msg; } ?> </p>
<?php
$userid=$_SESSION['sessionid'];
$ret=mysqli_query($con,"SELECT *FROM tbluser WHERE ID='$userid'");
$cnt=1;
while ($row=mysqli_fetch_array($ret))
{
?>
<form role="form" method="post" action="" class="form">
<p class="form-title">Your Profile</p>
<div class="item">
<label for="Fullname">Fullname:</label>
<input type="text" name="fullname" value="<?php echo $row['FullName'];?>" class="input" required>
</div>
<div class="item">
<label for="email">Email:</label>
<input type="email"class="input" value="<?php echo $row['Email'];?>" name="email" required>
</div>
<div class="item">
<label for="phone">Mobile Number:</label>
<input type="number"class="input" value="<?php echo $row['MobileNumber'];?>" name="phone" required>
</div>
<div class="item">
<label for="username">Username:</label>
<input type="text"class="input" value="<?php echo $row['Username'];?>" name="username" required>
</div>
<div class="item">
<label for="idnumber">Id Number:</label>
<input type="number"class="input" value="<?php echo $row['ID_Number'];?>" name="idnumber" required>
</div>
<div class="btn-block">
<button type="submit" value="Submit" class="input button" name="change_info">Change</button> `
</div>
</div>
<?php } ?>
</form></div>
</div>
</div>
<?php include_once('includes/footer.php');?>
<?php
}?>