create a code that create update profile like full name, address, mobile number and email address
PHP:
<?php
session_start();
include('includes/header.php');
include('includes/navbar.php');
if (!isset($_SESSION['email'])) {
header('Location: login.php');
}
$conn = mysqli_connect('localhost', 'root', '', 'bpms2db');
$email = $_SESSION['email'];
$query = "SELECT * FROM login WHERE Email='$email'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
if (isset($_POST['update_profile'])) {
$contactno = $_POST['mobilenumber'];
$query = "UPDATE login SET MobileNumber='$contactno' WHERE Email='$email'";
mysqli_query($conn, $query);
echo "<script>alert('Profile Updated Successfully');</script>";;
}
?>
<!DOCTYPE html>
<html lang="en">
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Admin Profile</h1>
</div>
<!-- Card Body -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Profile Page</h6>
</div>
<div class="card-body">
<form method="POST" enctype="multipart/form-data" class="form-horizontal">
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Full Name</label></div>
<div class="col-12 col-md-9"> <input type="text" name="fullname" class="form-control" value="<?php echo $row['FullName']; ?>"><br></div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Address</label></div>
<div class="col-12 col-md-9"> <input type="text" name="address" class="form-control" value="<?php echo $row['RegAddress']; ?>">
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Contact Number</label></div>
<div class="col-12 col-md-9"> <input type="text" name="mobilenumber" class="form-control" value="<?php echo $row['MobileNumber']; ?>">
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Email Address</label></div>
<div class="col-12 col-md-9"> <input type="email" name="email" class="form-control" value="<?php echo $row['Email']; ?>" readonly>
</div>
</div>
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" form-control-label">Registration</label></div>
<div class="col-12 col-md-9"> <input type="text" name="regist" class="form-control" value="<?php echo $row['RegDate']; ?>" readonly="true">
</div>
</div>
<p style="text-align: center;"> <button type="submit" class="btn btn-primary btn-sm" name="update_profile" value="Update Profile">Update</button></p>
</form>
</div>
</div>
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
</body>
</html>
<?php
include('includes/scripts.php');
?>