connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
// Process form submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get form data
$attraction_name = $_POST["attraction_name"];
$city_id = $_POST["city_id"];
$location = $_POST["location"];
$open_day = $_POST["open_day"];
$close_day = $_POST["close_day"];
$open_time = $_POST["open_time"];
$close_time = $_POST["close_time"];
$type = $_POST["type"];
$description = $_POST["description"];
$price = $_POST["price"];
$seller_id = $_SESSION['uid'];
$start=microtime(true);
// Insert data into the database
$sql = "INSERT INTO attraction ( name, city_id, location, seller_id, open_day, close_day, open_time, close_time, attraction_type_id, descrip, price) VALUES ('$attraction_name', '$city_id', '$location', '$seller_id', '$open_day', '$close_day', '$open_time', '$close_time', '$type', '$description', '$price')";
if ($conn->query($sql) === TRUE) {
$end = microtime(true);
$execution_time = $end - $start;
$phpVariable = "Add attraction success. Running time: " . $execution_time . "s";
echo '';
} else {
$end = microtime(true);
$execution_time = $end - $start;
echo "Error: " . $sql . "
" . $conn->error;
}
}
// close the database
$conn->close();
?>