Data array for controller

Asked

Viewed 177 times

0

good night

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

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

I’m not sure I made myself clear. I’m a beginner, thank you...

1 answer

0

Since I don’t know what technology you’re using, I’ll give you three solutions:

  1. When the controller(1) saves the data, put it in the session for the controller(2) to retrieve it and use it to send an email.
  2. When the controller(1) saves the data, put it into Hidden-Fields of the next page to be shown. Thus, when the controller(2) is called, it recovers the values of these Hidden-Fields.
  3. 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 interactions with the user, I strongly 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 in cookies.

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

Cookies store information regarding user profiles, so saving this data in cookies may not be the most appropriate way to deal with 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.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.