-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditprofile.php
More file actions
35 lines (35 loc) · 936 Bytes
/
editprofile.php
File metadata and controls
35 lines (35 loc) · 936 Bytes
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
<?php
include "config.php";
if(isset($_POST['edit']))
{
$id=$_SESSION['id'];
$username=$_POST['username'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$email=$_POST['email'];
$select= "select * from users where username='$username'";
$sql = mysqli_query($dbc,$select);
$row = mysqli_fetch_assoc($sql);
$res= $row['username'];
if($res === $username)
{
$update = "UPDATE users SET fname='$fname',lname='$lname',email='$email' where username='$username'";
$sql2=mysqli_query($dbc,$update);
if($sql2)
{
/*Successful*/
header('location:account.php');
}
else
{
/*sorry your profile is not update*/
header('location:profile_edit_form.php');
}
}
else
{
/*sorry your id is not match*/
header('location:profile_edit_form.php');
}
}
?>