diff --git a/controllers/tourController.js b/controllers/tourController.js
index c6fa09ccf861bf9676dd0d6c115aed9e7758272e..becdf95cdb76c973b10915c06b6e800d2aadcde9 100644
--- a/controllers/tourController.js
+++ b/controllers/tourController.js
@@ -211,10 +211,14 @@ exports.postEditTour = async (req, res) => {
   }
 
   const tourData = { name, description, price, duration };
+  const tourId = req.params.userId;  
+  if (!tourId) {
+    return res.status(400).send('ไม่พบข้อมูลทัวร์');
+  }
 
   try {
-    await Tour.updateTour(id, tourData); 
-    res.redirect('/tour/' + req.params.id); // ไปที่หน้ารายละเอียดทัวร์
+    await Tour.updateTour(tourId, tourData); 
+    res.redirect('/tour/' + tourId); // ไปที่หน้ารายละเอียดทัวร์
   } catch (error) {
     console.error('Error updating tour:', error);  // ข้อผิดพลาด
     res.status(500).send('เกิดข้อผิดพลาดในการแก้ไขทัวร์');