0
Scenario is as follows, I have a select Multiple with the options of the type of activity of each person registered in the system, however the same person can be a client and an employee, but when serializing the form with jquery I am receiving several variables from my select.
let form = $('#form-pessoas-cadastrar').serializeArray();
console.log(form);
$.post('/api/pessoas/store',form); // Só salva o ultimo valor "atividades[]=5"
My problem is in this part, I cannot serialize select to save the values in the same column of the database pessoas.atividades('1,3,5')
then I also have to do the reverse, bring the values of the bank pro select.
How were the activities defined in the database ? What is the structure of the table(s) related(s) ?
– Isac
@Isac mysql, varchar(10).
– Jean Freitas
And how I would keep the various values in one
varchar(10)
? Not to mention that this modeling is not correct because it will create difficulties later in relating activities with employees/customers– Isac
what you suggest?
– Jean Freitas
If each client and/or employee can serve several activities then the correct modeling would be to create a separate table that associates client/employee with activity. This however is not directly related to the problem indicated in the question
– Isac