-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
34 lines (27 loc) · 804 Bytes
/
process.php
File metadata and controls
34 lines (27 loc) · 804 Bytes
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
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "travelbuddy";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Prepare and bind
$stmt = $conn->prepare("INSERT INTO users (name, email, interests, trip_details) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssss", $name, $email, $interests, $trip_details);
// Set parameters and execute
$name = $_POST['name'];
$email = $_POST['email'];
$interests = $_POST['interests'];
$trip_details = $_POST['trip_details'];
$stmt->execute();
echo "New records created successfully";
$stmt->close();
$conn->close();
// Redirect back to the homepage
header("Location: index.php");
exit();
?>