-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_profile.php
More file actions
203 lines (181 loc) · 9.84 KB
/
user_profile.php
File metadata and controls
203 lines (181 loc) · 9.84 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php include('header.php');
$user_id =$_SESSION['id'];
$data = getUserDetails($user_id);
?>
<style>
.custom-radio {
position: absolute;
opacity: 0;
cursor: pointer;
}
.custom-radio+.form-check-label {
position: relative;
display: inline-block;
padding-left: 50px;
cursor: pointer;
font-size: 16px;
line-height: 20px;
margin-right: 10px;
}
.custom-radio+.form-check-label::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 40px;
height: 20px;
background-color: #ccc;
border-radius: 50px;
transition: background-color 0.3s, transform 0.3s;
}
.custom-radio+.form-check-label::after {
content: '';
position: absolute;
top: 2.5px;
left: 2px;
width: 15px;
height: 15px;
background-color: white;
border-radius: 50%;
transition: transform 0.3s;
}
.custom-radio:checked+.form-check-label::before {
background-color: #007bff;
}
.custom-radio:checked+.form-check-label::after {
transform: translateX(20px);
}
</style>
<section class="user_profile" style="background-color: #e6eef7;">
<div class="container-fluid">
<div class="row">
<div class="col-md-12 d-flex">
<div class="user_profile_card">
<div class="col-md-12 d-flex">
<div class="col-md-4 user_profile_card_left bg-light">
<div class="user_profile_content">
<div class="user_profile_image mt-3">
<img src="assest/user_img/<?php echo $data['image'] != '' ? $data['image'] : 'default_user.png'; ?>" alt="" style="height:85px;width:85px;" id="view_profile_pic" />
</div>
<div class="user_profile_name mt-2">
<h4>Ayan Kamila</h4>
</div>
</div>
<div class="user_profile_content_2">
<ul>
<a href="#" style="text-decoration:none;">
<li class="active"><span><i class="fa-solid fa-id-badge"></i></span> Profile Information</li>
</a>
<a href="#" style="text-decoration:none;">
<li><span><i class="fa-solid fa-location-dot"></i></span> Manage Addresses</li>
</a>
<a href="#" style="text-decoration:none;">
<li><span><i class="fa-solid fa-id-card"></i></span> Pan Card Information</li>
</a>
<a href="#" style="text-decoration:none;">
<li><span><i class="fa-solid fa-gift"></i></span> Gift Cards</li>
</a>
<a href="#" style="text-decoration:none;">
<li><span><i class="fa-solid fa-credit-card"></i></span> Saved Cards</li>
</a>
</ul>
</div>
</div>
<div class="col-md-8 user_profile_card_right">
<div class="col-md-12 personal_info_heading">
<h4>Personal Information</h4>
</div>
<div class="col-md-12 personal_info_heading_edit_btn_row">
<button class="btn btn-sm editbtn"><span><i class="fa-solid fa-pen-to-square" style="color: #ffffff;margin-right:6px;"></i></span>Edit</button>
</div>
<form class="" action="user_profile_update_action.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="user_id" value="<?php echo $data['id'];
?>" />
<div class="mb-2 row">
<div class="col-md-6">
<label for="firstname" class="form-label">First Name</label>
<input type="text" class="form-control" id="firstname" name="firstname" value="<?php echo $data['first_name']; ?>">
</div>
<div class="col-md-6">
<label for="lastname" class="form-label">Last Name</label>
<input type="text" class="form-control" id="lastname" name="lastname" value="<?php echo $data['last_name']; ?>">
</div>
</div>
<div class="mb-2 row">
<div class="col-md-5">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" value="<?php echo $data['username']; ?>">
<span id="username_status"></span> <!-- To show username availability status -->
</div>
<div class="col-md-7">
<label for="email" class="form-label">Email Id</label>
<input type="email" class="form-control" id="email" name="email" value="<?php echo $data['email']; ?>">
</div>
</div>
<div class="mt-3 row">
<div class="col-md-7 form-check ps-3">
<label for="gender" class="form-label">Gender</label><br>
<input type="radio" class="form-check-input custom-radio" id="male" name="gender" <?php echo $data['gender'] == 'Male' ? 'checked' : ''; ?>>
<label class="form-check-label" for="male">Male</label>
<input type="radio" class="form-check-input custom-radio" id="female" name="gender" <?php echo $data['gender'] == 'Female' ? 'checked' : ''; ?>>
<label class="form-check-label" for="female">Female</label>
<input type="radio" class="form-check-input custom-radio" id="others" name="gender" <?php echo $data['gender'] == 'Others' ? 'checked' : ''; ?>>
<label class="form-check-label" for="others">Others</label>
</div>
<div class="col-md-5">
<label for="dob" class="form-label">Date of Birh</label>
<input type="date" class="form-control" id="dob" name="dob" value="<?php echo $data['dob']; ?>" >
</div>
</div>
<div class="mb-2 row">
<div class="col-md-6">
<label for="mobile" class="form-label">Mobile No.</label>
<input type="digit" class="form-control" id="phone" name="phone" value="<?php echo $data['mobile_no']; ?>">
</div>
<div class="col-md-6">
<label for="profilepic" class="form-label">Profile Picture</label>
<input type="hidden" name="old_img" value="<?php echo $data['image']; ?>" />
<input type="file" class="form-control" id="pic" name="pic" accept="image/*" onchange="viewImage(this)">
</div>
</div>
<div class="mt-2 d-flex submit-button-row">
<button type="submit" class="user_profile_update_btn" value="submit" name="userProfileUpdateBtn" onclick="return formCheck();">Update</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include('footer.php'); ?>
<script>
document.querySelectorAll('.user_profile_content_2 ul li').forEach(item => {
item.addEventListener('click', () => {
document.querySelectorAll('.user_profile_content_2 ul li').forEach(li => {
li.classList.remove('active');
});
item.classList.add('active');
});
});
$(document).ready(function() {
$('#username').keyup(function() {
var username = $(this).val();
if (username.length > 0) {
$.ajax({
url: 'check_username.php',
method: 'POST',
data: {
username: username
},
success: function(response) {
$('#username_status').html(response);
}
});
} else {
$('#username_status').html('');
}
});
});
</script>