-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.php
More file actions
145 lines (120 loc) · 4.35 KB
/
driver.php
File metadata and controls
145 lines (120 loc) · 4.35 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
137
138
139
140
141
142
143
144
145
<html>
<head>
<!-- Meta -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="./css/host.css">
<!-- Formoid Stuff -->
<link rel="stylesheet" href="formoid_files/formoid1/formoid-solid-blue.css" type="text/css" />
<script type="text/javascript" src="formoid_files/formoid1/jquery.min.js"></script>
<script type="text/javascript" src="formoid_files/formoid1/formoid-solid-blue.js"></script>
<!-- Functions -->
<?php
session_start();
include '../config.php';
$event_code = $_SESSION['event_code'];
echo $event_code;
$conn = mysqli_connect($host, $user, $password, $db);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$get_event_name = sprintf("SELECT event_name FROM host WHERE event_code = '%s'", $event_code);
$query_result = mysqli_query($conn, $get_event_name);
if (!$query_result) {
echo 'Could not run query: ' . mysqli_error();
exit;
}
$row = mysqli_fetch_array($query_result);
$event_name = $row[0];
echo $row;
?>
</head>
<body class="blurBg-false" style="background-color:#EBEBEB">
<div class = "title page">
"Become a driver"
</div>
<!-- PHP form validation -->
<!-- Start Formoid form-->
<form class="formoid-solid-blue" style="background-color:#FFFFFF;font-size:14px;font-family:'Roboto',Arial,Helvetica,sans-serif;color:#34495E;max-width:480px;min-width:150px" method="post">
<div class="title">
<h2>Become a driver</h2>
</div>
<div class="element-input">
<label class="title">
<h3 class="section-break-title"> Event Name: <?php echo $event_name; ?> </h3>
</label>
<div class="item-cont">
<input class="large" type="text" name="driver_name" placeholder="Driver Name"/>
<span class="icon-place"></span>
</div>
<div class="element-separator"><hr>
<h3 class="section-break-title">Map</h3>
</div>
<!-- Maps placement -->
<input id="pac-input" class="controls" type="text" placeholder="Search Box" name="searchbox_input">
<div id="map" style="width:80%px; height:500px"></div>
<div>
Area Code:
<input id = "addressArea" name= "place_id">
</div>
</div>
<div class="submit">
<input type="submit" value="Submit" />
</div>
</form>
<p class="frmd">
<a href="http://formoid.com/v29.php">web forms</a>
Formoid.com 2.9
</p>
<!-- Stop Formoid form-->
</body>
<?php
// session_start();
// bring in db configure
// define variables and set to empty values
// function test_input($data) {
// $data = trim($data);
// $data = stripslashes($data);
// $data = htmlspecialchars($data);
// return $data;
// }
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$driver_name = $place_id = "";
// $doc = new DomDocument;
// // We need to validate our document before refering to the id
// $doc->validateOnParse = true;
// $doc->Load('host.php');
// $docElement = $doc->getElementById('addressArea') ;
// $place_id = DOMinnerHTML($docElement);
// $place_id = test_input($_POST['variable']);
$place_id = $_POST["place_id"];
$driver_name = $_POST["driver_name"];
// $place_id = test_input($_POST['variable']);
// Create connection
// $conn = mysqli_connect($host, $user, $password, $db);
// Check connection
// if (!$conn) {
// die("Connection failed: " . mysqli_connect_error());
// }
// create sql command
$sql = sprintf("INSERT INTO driver (driver_name,place_id,event_code) VALUES ('%s','%s','%s')", $driver_name , $place_id , $event_code);
// $sql = sprintf("INSERT INTO host (event_name) VALUES ('%s')", $event_name );
// $sql = sprintf("INSERT INTO host (place_id) VALUES ('%s')" , $place_id );
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
echo $sql;
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
mysqli_close($conn);
?>
<!-- Google Map Placement API -->
<script src="./js/host_google_maps.js"></script>
<!-- Google API javascript reference -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAJ_0Uy4w3qTnmYQCnGZZIcHQk5Hu9j4MA&libraries=places&callback=initMap"
async defer></script>
<script scr="./js/jquery-3.1.1.js"
</html>