-
Notifications
You must be signed in to change notification settings - Fork 0
/
secNewDes.php
51 lines (50 loc) · 1.29 KB
/
secNewDes.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<title>Secretery's new Reservation Page</title>
</head>
<body>
<?php
session_start();
if(!isset($_SESSION["username"]))
header("Location: login.html");
include "config.php";
$conn -> select_db("heroku_ed39a20fb4d6fd8");
$cityname = $_POST["cityname"];
$countryname = $_POST["countryname"];
if(!empty($cityname) && !empty($countryname)){
$sql = "INSERT INTO destination(city_name, country_name)
VALUES ('$cityname', '$countryname')";
if (mysqli_query($conn, $sql)){
echo "New record created successfully. <br>Redirecting to Secretery's new Reservation Page.";
?>
<script>
setTimeout(function() {
window.location.href="secretaryNewDest.php";
}, 3000);
</script>
<?php
}else {
echo mysqli_error($conn);
?>
<script>
setTimeout(function() {
window.location.href="secretaryNewDest.php";
}, 3000);
</script>
<?php
}
}else{
echo "Please fill all fields. <br>Redirecting to Secretery's new Reservation Page.";
?>
<script>
setTimeout(function() {
window.location.href="secretaryNewDest.php";
}, 3000);
</script>
<?php
}
?>
</body>
</html>