Next: I use RSForm! and instead of using the Mapping functionality it offers, I script the Update user has already registered) and Insert (if you do not have one). This script is inserted in the "Script called on form process"
part. Here I do the tests and I update or I insert the data in the bank.
My problem is this: I have 1 drop down on the form whose items are assigned through an array, as per the code below:
*//<code>
$items = array('','1|Solteiro','2|Casado','3|Marital','4|Desquitado','5|Divorciado','6|Viúvo','7|Outros');
$db = JFactory::getDbo();
$idUsuarioLogado = JFactory::getUser()->id;
$db->setQuery("SELECT estado_civil FROM minha_tabela WHERE id_usuario = $idUsuarioLogado");
$result = $db->loadObject();
foreach ($items as $chave => $item) {
if($result->estado_civil == $chave){
$items[$chave] = $item."[c]";
}else{
$items[$chave] = $item;
}
}
$items = implode("\n", $items);
return $items;
//</code>*
When the user is logged in and has already registered, he / she brings the data from the correct bank and populates the drop down. When it is not, it fills in the list for the user to choose.
The problem is: how do I insert the selected value into the database in the drop down?
Because if I just get like this: $estado_civil = $_POST['form']['estadocivil'];
It returns an array and does not insert anything into the database.
Does anyone have a light?
PS: When I use Mapping and do an INSERT , it usually inserts the drop down data into the database. I do not use Mapping because I need to test if I'm going to give an UPDATE or an INSERT in the database. And I have not found out if this test can be done using this functionality.