-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanage.php
More file actions
136 lines (118 loc) · 4.5 KB
/
manage.php
File metadata and controls
136 lines (118 loc) · 4.5 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
<!DOCTYPE html>
<?php
include_once 'C:\xampp\htdocs\CarRentalSystem\once.php';
session_start();
$email = $_SESSION['email'];
$query=mysqli_query($connect,"select * from customer where Email = '$email'");
$fetch = mysqli_fetch_assoc($query);
$Fname = $fetch["Fname"];
$Lname = $fetch["Lname"];
$phone = $fetch["phone_number"];
$country = $fetch["Country"];
if (isset($_POST["submit"])) {
$Fname = $_POST["Fname"];
$Lname = $_POST["Lname"];
$phone = $_POST["phone"];
$country = $_POST["country"];
$temp = $connect->prepare("UPDATE customer SET Fname='$Fname',Lname='$Lname',phone_number='$phone',Country='$country' WHERE Email='$email'");
$temp->execute();
header('location:welcome user.php');
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link href="manage.css" rel="stylesheet">
<link rel="icon" href="https://cdn-icons-png.flaticon.com/512/809/809998.png" type="image/x-icon">
<title>Car Rental - Manage Account</title>
<script src="https://kit.fontawesome.com/77fd9664d1.js" crossorigin="anonymous"></script>
<script>
function validateForm(){
var a= document.forms["save"]["Fname"].value;
var b= document.forms["save"]["Lname"].value;
var c= document.forms["save"]["phone"].value;
if(a==""){
alert("You must enter First name");
return false;
}
else if(b==""){
alert("You must enter Last Name");
return false;
}
else if(c==""){
alert("You must enter Phone");
return false;
}
if (isNaN(c))
{
alert("enter a valid Phone");
return false;
}
}
</script>
</head>
<body>
<nav class ="navbar">
<div class="logo"><a href="welcome user.php">Car Rental <i class="fas fa-car"></i></a></div>
<ul class="menu">
<li><a href="welcome user.php">Home</a></li>
<li>
<a href="#">Account</a>
<ul class="dropdown">
<li><a href="#">Manage your account</a></li>
<li><a href="index.php">Log out</a></li>
</ul>
</li>
<li><a href="#">About us</a></li>
</ul>
</nav>
<h1> Manage Your Account</h1>
<form id="save" name="save" action="#" onsubmit="return validateForm()" method="post">
<section class="content">
<div class="specs">
<div class="info">
<p>First Name:</p>
<input type="text" class="form-control" name="Fname" id="Fname" value="<?= $Fname ?>"/>
</div>
<div class="info">
<p>Last Name:</p>
<input type="text" class="form-control" name="Lname" id="Lname" value="<?= $Lname ?>"/>
</div>
<div class="info">
<p>Phone:</p>
<input type="text" class="form-control" name="phone" id="phone" value="<?= $phone ?>"/>
</div>
<div class="info">
<p>Country:</p>
<?php if($country == 'EGY'){ ?>
<select name="country" id="country">
<option value="EGY" selected>Egypt</option>
<option value="USA">United States</option>
<option value="KSA">Saudie Arabia</option>
</select>
<?php }elseif($country == 'USA') { ?>
<select name="country" id="country">
<option value="EGY">Egypt</option>
<option value="USA" selected>United States</option>
<option value="KSA">Saudie Arabia</option>
</select>
<?php } elseif($country == 'KSA'){ ?>
<select name="country" id="country">
<option value="EGY">Egypt</option>
<option value="USA" >United States</option>
<option value="KSA" selected>Saudie Arabia</option>
</select>
<?php } ?>
</div>
</div>
<div>
<button type="submit" class="btn btn-larger btn-block" value='submit' name="submit">Save</button>
</div>
</section>
</form>
<footer>
<p><a href="">Contact us</a></p>
</footer>
</body>
</html>