-
Notifications
You must be signed in to change notification settings - Fork 2
/
editProfile.php
54 lines (39 loc) · 1.42 KB
/
editProfile.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
<?php
session_start();
require_once "./functions/database_functions.php";
$title = "Edit Profile";
require "./template/header.php";
$conn = db_connect();
$firstname = trim($_POST['firstname']);
$firstname = mysqli_real_escape_string($conn, $firstname);
$lastname = trim($_POST['lastname']);
$lastname = mysqli_real_escape_string($conn, $lastname);
$email = trim($_POST['email']);
$email = mysqli_real_escape_string($conn, $email);
$address = trim(trim($_POST['address']));
$address = mysqli_real_escape_string($conn, $address);
$city = trim($_POST['city']);
$city = mysqli_real_escape_string($conn, $city);
$zipcode = trim($_POST['zipcode']);
$zipcode = mysqli_real_escape_string($conn, $zipcode);
$customer = getCustomerIdbyEmail($_SESSION['email']);
$id=$customer['id'];
$query="UPDATE customers set
firstname='$firstname', lastname='$lastname' , address='$address', city='$city', zipcode='$zipcode' ,email='$email' where id='$id'
";
mysqli_query($conn, $query);
?>
<p class="lead text-success" id="p">Your Profile has been updated sucessfully..</p>
<script>
window.setTimeout(function()
{
window.location.href = "http://localhost/med/index.php";
}
, 3000);
</script>
<?php
if(isset($conn)){
mysqli_close($conn);
}
require_once "./template/footer.php";
?>