Yii Framework Forum: Retreive Data From A View And Keep It Alive Until You Start Another Search - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Retreive Data From A View And Keep It Alive Until You Start Another Search Hotel reservation Rate Topic: -----

#1 User is offline   Trinh Duy Hung 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 26-October 12

Posted 26 November 2012 - 09:52 PM

Hello everyone!

I'm working on a hotel reservation project. And I'm at the step of searching hotels.

Here is my design form:

Attached File  searchbox.png (7.1K)
Number of downloads: 13

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!

Cheers!

P/s: in mean time I'm going to look for the solution. If find it I'll post it here.
0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,707
  • Joined: 04-March 10
  • Location:UK

Posted 27 November 2012 - 10:40 AM

Maybe you could hold the values that you need to keep in hidden form fields so they get posted back each time?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users