Save user message to text file or database?

Asked

Viewed 349 times

0

I am developing a PHP system following the MVC(Model-View-Controller) standard. I decided to create an account deletion page for users and display a text field so that they can inform us why they are abandoning the system. My question is whether I should save these messages in a text file or in a database table. I also thought of creating a list with possible reasons for system abandonment and the user would only need to select the option from the compatible list. 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 abandoning the system for an undisclosed reason.

1 answer

2


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

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

Proposal for Database Modeling

Follows a proposed table structure 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.

Browser other questions tagged

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