-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetails.php
114 lines (100 loc) · 3.7 KB
/
details.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
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
<?php
require_once 'components/db_connect.php';
if ($_GET['id']) {
$id = $_GET['id'];
$sql = "SELECT * FROM offers_table WHERE id = {$id}";
$result = $connect->query($sql);
if ($result->num_rows == 1) {
$data = $result->fetch_assoc();
$locationName = $data['locationName'];
$image = $data['image'];
$description = $data['description'];
$price = $data['price'];
$long = $data['long'];
$lat = $data['lat'];
$about = $data['about'];
$date = $data['date'];
} else {
header("location: error.php");
}
} else {
header("location: error.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php require_once 'components/boot.php'?>
<title>details</title>
<style>
#map {
height: 60%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class='col-lg-6 col-md-3 col-sm-1 px-2 box-height mt-3 mb-3 mb-lg-0 al shadow-sm px-2 bg-body rounded'>
<p class=' text-center px-2 h4'>The offer</p>
<p class='text-center'> <?php echo $description ?></p>
<div class='col text-center '>
<p class='text-center'> Date : <?php echo $date ?> </p>
</div>
<div class='col text-center '>
<p class='text-center'> Price : € <?php echo $price ?> </p>
</div>
</div>
<div class='col-lg-6 col-md-6 col-sm-1 box-height mb-2 mb-lg-0 al shadow-sm px-3 mt-3 bg-body rounded'>
<!-- <div class='col text-center '> -->
<p class=' text-center px-2 h4'>About <?php echo $locationName ?></p>
<!-- </div> -->
<div class='col text-center '>
<p class='text-center'> <?php echo $about ?> </p>
</div>
<div class='col text-center '>
<p class='text-center'> Longitude : <?php echo $long ?> </p>
</div>
<div class='col text-center '>
<p class='text-center'> Latitude : <?php echo $lat ?> </p>
</div>
</div>
<div class="container d-flex justify-content-center mb-3">
<a href='index.php?id=<?=$id;?>'><button class="btn btn-warning" type='button'>Back</button></a>
</div>
</div>
</div>
<!-- ===================== MAP SPACE & map script======================= -->
<div class="container" id="map"></div>
<script>
let longitude=<?php echo $long ?>;
let latitude=<?php echo $lat ?>;
console.log(latitude );
console.log(longitude );
var map;
function initMap() {
var city = {
lat: latitude,
lng: longitude
};
map = new google.maps.Map(document.getElementById('map'), {
center: city,
zoom: 8
});
var pinpoint = new google.maps.Marker({
position: city,
map: map
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBtjaD-saUZQ47PbxigOg25cvuO6_SuX3M&callback=initMap" async defer></script>
</body>
</html>