Save user message to text file or database? [closed]

0

I'm developing a system in PHP following the MVC (Model-View-Controller) standard. I have decided to create an account exclusion page for users and display a text field so they can tell us why they are leaving the system. My question is whether to save these messages to a text file or to a database table. I also thought about creating a list with possible reasons for abandoning the system and the user would only need to select the compatible list option. However, in this alternative way, I would limit the user only to the list I created, that is, I would not know if he would be leaving the system for an unnamed reason.

    
asked by anonymous 30.06.2015 / 19:34

1 answer

2

Bruno , you are probably already working with the database. In this case, the ideal thing is to keep everything in the database.

In HTML, you can include the default list (with radiobox ) of reasons and also a field ( textarea ) for writing to the very handle of the reason for the cancellation. In PHP, just check if the radiobox that came is outro_motivo , if it is, then $motivo = $_POST['textarea_do_motivo'] .

Database Modeling Proposal

Here's a table structure proposal cancelamentos ( MySQL ):

CREATE TABLE 'cancelamentos' (
  'id_cancelamento' int(11) NOT NULL AUTO_INCREMENT,
  'id_usuario' varchar(255) NOT NULL DEFAULT '',
  'data' datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  'motivo' longtext,
  PRIMARY KEY ('id_cancelamento')
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Even if the user chooses an item ( radiobox ) from the list, this item would be saved in the motivo field.

    
30.06.2015 / 19:41