-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHotel Registration.php
118 lines (105 loc) · 4.08 KB
/
Hotel Registration.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
115
116
117
118
<?php
require 'functions.php';
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Hotel Registration</title>
<link rel="stylesheet" href="style2.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<div class="title">Hotel Registration</div>
<div class="content">
<form method="post"> <!-- Specify the PHP file where the form data will be sent -->
<div class="user-details">
<!-- Add name attributes to the input fields to capture the data in PHP -->
<div class="input-box">
<span class="details">Hotel Name</span>
<input type="text" name="hotelName" placeholder="Enter hotel name" required>
</div>
<div class="input-box">
<span class="details">Onwer Name</span>
<input type="text" name="ownerName" placeholder="Enter your name" required>
</div>
<div class="input-box">
<span class="details">Email</span>
<input type="email" name="email" placeholder="Enter your email" required>
</div>
<div class="input-box">
<span class="details">Phone Number</span>
<input type="text" name="phoneNumber" placeholder="Enter your number" required>
</div>
<div class="input-box">
<span class="details">GST Number</span>
<input type="text" name="gstNumber" placeholder="Enter GST No." required>
</div>
<div class="input-box">
<span class="details">Address</span>
<input type="text" name="address" placeholder="Enter Address" required>
</div>
<div class="input-box">
<span class="details">Pincode</span>
<input type="text" name="pincode" placeholder="Enter Pincode" required>
</div>
<div class="input-box">
<span class="details">City</span>
<input type="text" name="city" placeholder="Enter City" required>
</div>
<div class="input-box">
<span class="details">State</span>
<input type="text" name="state" placeholder="Enter State" required>
</div>
<div class="input-box">
<span class="details">Location</span>
<input type="text" name="location" placeholder="Enter Google Maps Link" required>
</div>
</div>
<div class="button">
<input type="submit" name="register" value="Register">
</div>
</div>
</form>
</div>
</div>
</body>
</html>
<?php
// // Database connection parameters
// $host = "localhost"; // Replace with your database host name or IP address
// $username = "root"; // Replace with your database username
// $password = ""; // Replace with your database password
// $database = "tourism_db"; // Replace with your database name
// // Create a database connection
$conn = connect();
// Check the connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == 'POST') {
// Get form data
$hotelName = $_POST['hotelName'];
$ownerName = $_POST['ownerName'];
$email = $_POST['email'];
$phoneNumber = $_POST['phoneNumber'];
$gstNumber = $_POST['gstNumber'];
$address = $_POST['address'];
$pincode = $_POST['pincode'];
$city = $_POST['city'];
$state = $_POST['state'];
$location = $_POST['location'];
// SQL query to insert data into the table
$sql = "INSERT INTO hotel_registration (ID,hotel_name, owner_name, email, phone_number, gst_number, address, pincode, city, state, location) VALUES (1,'$hotelName', '$ownerName', '$email', '$phoneNumber', '$gstNumber', '$address', '$pincode', '$city', '$state', '$location')";
if (mysqli_query($conn, $sql)) {
echo "Registration successful!";
header("Location: Hotel Dashboard.html");
exit();
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
// Close the database connection
}
?>