denhamd2 Posted May 16, 2007 Share Posted May 16, 2007 Hi, I have a set up a booking form with 2 calendars for 2 houses: http://www.aholidayinspain.net/booking/index-booker.php It basically collects the dates selected, goes to a confirmation page where it just echos the dates and then on the third page it inserts it into the database tables, house 1's table is called "bookings" and house 2's table is called "house2bookings". However, when you try to book a date for 1 of the houses it actually inserts the date into both of the tables because it just inserts all the session variables we have collected into both. Is there any way I can separate the house 2 bookings from the house 1 ones and then insert them into the separate tables? Bear in mind that all house 2 variable names start with "house2" on the form on page 1. Here is my PHP code: <?php // Get all the session variables stored in the previous page: $un_neces_varible = array('contactsubmit'); foreach($_SESSION['DATA'] as $v) { if(!in_array($key,$un_neces_varible)){ mysql_query("INSERT INTO bookings (date, theuserid) VALUES('$v','$recentuser') ") or die(mysql_error()); } } ?> <?php // Get all the session variables stored in the previous page: $un_neces_varible = array('contactsubmit'); foreach($_SESSION['DATA'] as $v) { if(!in_array($key,$un_neces_varible)){ mysql_query("INSERT INTO house2bookings (house2date, house2theuserid) VALUES('$v','$recentuser') ") or die(mysql_error()); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/51637-booking-form-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.