I’m working on a hotel reservation project. And I’m at the step of searching hotels.
Here is my design form:
Let me explain more:
- the field Hotel is used for customers to fill in the city that they desire to go for example: London.
There is a table name tbl_hotel and it has a column of city_id that comes from another table named tbl_city.
- next two fields are used to collect check in and check out day. I have to retrieve this information and store it to my table named tbl_booking.
The point is: after filling in all information, a list of corresponding hotels will be displayed. From that customers can choose a hotel and book that hotel with check in and check out that are already specified. So actually the search button should associated with another view and we should pass the check in and check out day to this view. The question is how to do that? And still possibly to retrieve check in and check out and store in my table. My first thinking is to use session variable but if the customer go back to the search view (the view that is responsible for collect user’s input check in, check out and city to go) and do another search. So session might not the appropriate one here. Using php code to pass variable from one script to another is quite clear and simple but to do that in a yii way I’m still not familiar with. And by the way how to associate a button search with a view. I mean something like action attribute in form element. The search view is using CActiveForm with a CHtml::submitButton(‘Search’). So by default (I think so) the button is associated with the action (in this case actionSearch) of the controller.
Sorry for a long post but I just want to explain clearly.
Anyway thank you for your time and from now I’m looking for some replies from you!
P/s: in mean time I’m going to look for the solution. If find it I’ll post it here.