Data array for controller

0

Good evening

My controller (1) receives the data via input post from the fields of a form and throws them into an array. Subsequently the data is sent to a view (e-mail template) which is not going to be rendered.

My other controller (2) is responsible for triggering the emails with those data that are in the other controller, and I do not know how to do this without saving the data in the DB (I do not want to write to db) >

I do not know if I was clearer. I'm a beginner ... thank you

    
asked by anonymous 17.05.2015 / 22:11

1 answer

0

As I do not know which technology you're using, I'll give you three solutions:

  • When the controller (1) saves the data, put it in the session for the controller (2) to retrieve it and use it to send email.
  • When controller (1) saves the data, place them in hidden-fields of the next page to be displayed. So, when the controller (2) is called, it retrieves the values of these hidden-fields.
  • When the controller (1) saves the data, place it in cookies that are stored in the browser. The controller (2) can then retrieve these values and send them by email.
  • However, if this data is to be sent after some user interaction, I highly recommend that you save it in the database because any other solution would be non-trivial except in cases where you save the data in the session or cookies.

    Note that saving save data in the session is not very recommended, except for the essentials, as this can greatly burden the memory of the application server.

    Cookies store information about user profiles so saving that data to cookies may not be the most appropriate way to handle these values.

    I particularly like the idea of saving this information in a database, or if it is saved in the next user interaction, save it in hidden-fields.

        
    18.05.2015 / 01:26