-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathedit office.php
More file actions
100 lines (91 loc) · 3.53 KB
/
Copy pathedit office.php
File metadata and controls
100 lines (91 loc) · 3.53 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
<!DOCTYPE html>
<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="edit office.css" rel="stylesheet">
<link rel="icon" href="https://cdn-icons-png.flaticon.com/512/809/809998.png" type="image/x-icon">
<title>Car Rental - edit office</title>
<script src="https://kit.fontawesome.com/77fd9664d1.js" crossorigin="anonymous"></script>
</head>
<?php
include_once 'C:\xampp\htdocs\CarRentalSystem\once.php';
session_start();
$office = $_GET['office'];
$query=mysqli_query($connect,"select * from office where Office_id = '$office'");
$fetch = mysqli_fetch_assoc($query);
$name = $fetch["Office_name"];
$country = $fetch["Country"];
$city = $fetch["City"];
$address = $fetch["Address"];
if (isset($_POST["submit"])) {
$name = $_POST["name"];
$country = $_POST["country"];
$city = $_POST["city"];
$address = $_POST["address"];
$temp = $connect->prepare("UPDATE office SET Office_name='$name',Country='$country',City='$city',office.Address='$address' WHERE Office_id='$office'");
$temp->execute();
header('location:welcome admin.php');
}
?>
<body>
<nav class ="navbar">
<div class="logo"><a href="welcome admin.php">Car Rental <i class="fas fa-car"></i></a></div>
<ul class="menu">
<li><a href="welcome admin.php">Home</a></li>
<ul class="dropdown">
<li><a href="index.php">Log out</a></li>
</ul>
<li><a href="">About us</a></li>
</ul>
</nav>
<h1> Edit Office</h1>
<form id="save" name="save" action="#" onsubmit="return validateForm()" method="post">
<section class="content">
<div class="specs">
<div class="info">
<p>Office Name:</p>
<input type="text" class="form-control" name="name" id="name" value="<?= $name ?>"/>
</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 class="info">
<p>City:</p>
<input type="text" class="form-control" name="city" id="city" value="<?= $city ?>"/>
</div>
<div class="info">
<p>Office Address:</p>
<input type="text" class="form-control" name="address" id="address" value="<?= $address ?>"/>
</div>
</div>
<div>
<button type="submit" class="btn btn-larger btn-block" value='submit' name="submit">Save</button>
</div>
</div>
</section>
</form>
<footer>
<p><a href="">Contact us</a></p>
</footer>
</body>
</html>