Let's suppose I have a large form, 30 fields containing textareas
, radio buttons
, checkboxes
, select tags
, etc.
After the submit
of the form, what would be the best way to get these values and then save them to the bank? Best practice, I say use as few rows as possible.
I do it this way
$nome = $_POST['nome '];
$idade = $_POST['idade '];
$cidade = $_POST['cidade '];
And so it goes ...
"UPDATE nome_tabela SET var1='$var1', var2='$var2', var3='$var3',...,'var30=$var30' WHERE id='$id'"
There should be a much easier way to do this (perhaps with a foreach
). ideas, suggestions are all welcome.