connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
// Process form submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get form data
$restaurant_name = $_POST["restaurant_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"];
$style = $_POST["style"];
$description = $_POST["description"];
$fee = $_POST["fee"];
$seller_id = $_SESSION['uid'];
$start=microtime(true);
// Insert data into the database
$sql = "INSERT INTO restaurant ( name, city_id, location, seller_id, open_day, close_day, open_time, close_time, restaurant_style_id, descrip, fee) VALUES ('$restaurant_name', '$city_id', '$location', '$seller_id', '$open_day', '$close_day', '$open_time', '$close_time', '$style', '$description', '$fee')";
if ($conn->query($sql) === TRUE) {
$end = microtime(true);
$execution_time = $end - $start;
$phpVariable = "Add restaurant 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();
?>