beginTransaction(); try { // Split name into first and last $nameParts = explode(' ', $name, 2); $firstName = $nameParts[0]; $lastName = $nameParts[1] ?? ''; // Save customer (with default phone number) $stmt = $pdo->prepare("INSERT INTO customers (first_name, last_name, email, phone, created_at) VALUES (?, ?, ?, '0000000000', NOW())"); $stmt->execute([$firstName, $lastName, $email]); $customer_id = $pdo->lastInsertId(); // Get tour price $tourStmt = $pdo->prepare("SELECT price, discount_price FROM tours WHERE tour_id = ?"); $tourStmt->execute([$tour_id]); $tour = $tourStmt->fetch(); $price = $tour['discount_price'] ?? $tour['price']; $total_amount = $price * $people; // Save booking $bookingStmt = $pdo->prepare("INSERT INTO bookings (tour_id, customer_id, booking_date, start_date, end_date, num_adults, special_requests, status, total_amount, created_at) VALUES (?, ?, NOW(), ?, ?, ?, ?, 'pending', ?, NOW())"); $bookingStmt->execute([ $tour_id, $customer_id, $date, $date, // Using same date as end date for single day tours $people, $notes, $total_amount ]); $booking_id = $pdo->lastInsertId(); // Create invoice $invoiceStmt = $pdo->prepare("INSERT INTO invoices (booking_id, invoice_number, issue_date, due_date, amount, total_amount, status, created_at) VALUES (?, ?, CURDATE(), DATE_ADD(CURDATE(), INTERVAL 7 DAY), ?, ?, 'sent', NOW())"); $invoice_number = 'INV-' . date('Ymd') . '-' . str_pad($booking_id, 5, '0', STR_PAD_LEFT); $invoiceStmt->execute([ $booking_id, $invoice_number, $total_amount, $total_amount ]); // Commit transaction $pdo->commit(); // Success message $_SESSION['success'] = "Thank you for your booking! Your booking reference is: " . $invoice_number; // Redirect to prevent form resubmission header("Location: ".$_SERVER['PHP_SELF']); exit(); } catch (PDOException $e) { // Rollback transaction on error $pdo->rollBack(); $errors[] = "Database error: " . $e->getMessage(); error_log("Booking Error: " . $e->getMessage()); } } } // Fetch home category packages from database $homePackages = []; try { // Get category ID for home $categoryStmt = $pdo->prepare("SELECT category_id FROM categories WHERE slug = 'home'"); $categoryStmt->execute(); $category = $categoryStmt->fetch(); if ($category) { // Fetch packages in home category $packageStmt = $pdo->prepare(" SELECT t.*, ti.image_url as featured_image FROM tours t LEFT JOIN tour_images ti ON t.tour_id = ti.tour_id AND ti.is_primary = 1 WHERE t.category_id = ? AND t.is_active = 1 ORDER BY t.is_featured DESC, t.title ASC LIMIT 6 "); $packageStmt->execute([$category['category_id']]); $homePackages = $packageStmt->fetchAll(); } } catch (PDOException $e) { error_log("Error fetching home packages: " . $e->getMessage()); } ?>
We know Tanzania really well, and we're here to plan a trip that's just right for you. Your travel expert will put together a special journey based on what you love.
Our tours are carefully designed by experts with deep local knowledge.
We know every corner of Tanzania and can guide you to hidden gems.
Your payments are secure and we offer flexible cancellation policies.
Your comfort and security are our top priorities throughout your journey.
We're passionate about conservation and sustainable tourism.
Our guides are highly trained professionals with years of experience.
Set out on an unforgettable expedition and experience the awe-inspiring scenery, diverse heritage, and warm hospitality that Tanzania and its extraordinary people graciously extend.
Endless savannas stretch beneath golden skies, where paws tread softly and wings glide free in the morning light. Elephants roam, lions call, and every sunrise begins a wild, untold story. From the heart of the land to the calm of Zanzibar's beaches, Tanzania stirs the soul at every turn. A journey shaped by nature raw, beautiful, and truly unforgettable.
Every detail carefully planned for maximum enjoyment.
Carefully selected lodges and camps for your comfort.
Competitive pricing without compromising quality.
Seamless transportation throughout your journey.
We craft our packages to your preferences
= htmlspecialchars($shortDescription) ?>
Hear from travelers who've experienced Tanzania with us.