Send Same Model Object From Many Pages To 1 Page?

Im currently getting with this issue, send same object data ( model : User) from many pages to 1 one page, not same time. But how can I recognize which object that has been sent from which page? For example: I have 2 pages called: page1.php and page2.php that will send data of model User to main.php. But in the controller which contain main.php, there is only one way I know is isset($_POST[‘User’]) to check the exist of the model USer that has been sent, could not know it is sent from page1 or page2. I have one solution is pass one more variable so called $page. So I will check that if $page = page1, the data will be processed and be sent back to page1. However, I dont think it’s good idea when there are many pages more than 2 pages, and i’m looking for a more convenient solution by using Yii style :D. Anyone have ideas about it?

I think its a bad pattern: a controller that perform action of two actions? Why?

I think page1 will process different data from page2. So, … you could know right page to call checking what kind of data you have.

I believe that you misunderstand my point. That’s not about the structure, it’s about technical. Here the code of the MainController:




if(isset($_POST['User']) && ($_POST['page'] == "page1"))             

    {                    

      do something 

      $this->render('page1',array( ..));          

    }  		

if(isset($_POST['User']) && ($_POST['page'] == "page2") ) 

   {   

     do something 

      $this->render('page2',array( ..));                  

   }  			

			



It worked correctly, but I’m not satisfied with this. As these code above, you can see that main.php retrieve 2 User model objects, but without the $page, cannot know where is this from. In php, I can name the variable like:page1_input then send it. Then get it with (isset($_POST[‘page1_input’]) and I know which ones send it.