-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditprofile.php
More file actions
104 lines (98 loc) · 2.14 KB
/
editprofile.php
File metadata and controls
104 lines (98 loc) · 2.14 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
session_start();
include "dbconfigure.php";
if(verifyuser())
{
$u = $_SESSION['semail'];
$query = "select * from siteuser where emailid='$u'";
$rs = my_select($query);
if($row=mysqli_fetch_array($rs))
{
$username = $row[0];
$city = $row[2];
$address = $row[3];
$contact = $row[5];
}
}
else
{
header("location:login.php");
}
?>
<html>
<head>
<?php include "header.php"; ?>
<style>
td{color : brown}
</style>
</head>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<body>
<?php include "nav2.php";
echo "<br> Welcome <b style = 'color : green ; text-transform:capitalize'>$username</b>";
?>
<div class="container" >
<h1 class="text-center" style = "font-family : Monotype Corsiva ; color : red">Edit Profile</h1>
<br>
<br>
<form method="post">
<table class="table">
<tr>
<th>UserName</th>
<td><input type = text name=username1 class="form-control" value="<?php echo $username; ?>"></td>
</tr>
<tr>
<th>City</th>
<td><input type = text name=city1 class="form-control" value="<?php echo $city; ?>"></td>
</tr>
<tr>
<th>Address</th>
<td><textarea name=address1 class="form-control" ><?php echo $address; ?></textarea></td>
</tr>
<tr>
<th>EmailID</th>
<td><input type = text readonly name=emailid1 class="form-control" value="<?php echo $u; ?>"></td>
</tr>
<tr>
<th>Contact</th>
<td><input type = text name=contact1 class="form-control" value="<?php echo $contact; ?>"></td>
</tr>
</table>
<br>
<input type = submit value="Submit" name="edit" class="btn btn-primary">
</form>
</div>
</body>
</html>
<?php
if(isset($_POST['edit']))
{
$username1 = $_POST['username1'];
$city1 = $_POST['city1'];
$address1 = $_POST['address1'];
$contact1 = $_POST['contact1'];
$query = "update siteuser set username='$username1',city='$city1',address='$address1',contact='$contact1' where emailid='$u'";
$n = my_iud($query);
if($n==1)
{
echo '<script>
swal({
text: "Profile updated!",
icon: "success",
}).then(function() {
window.location.href = "userhome.php";
});
</script>';
}
else{
echo '<script>
swal({
text: "Try again!",
icon: "warning",
}).then(function() {
window.location.href = "editprofile.php";
});
</script>';
}
}
?>