• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Insert selected value into array / drop down

Insert selected value into array / drop down 10 years 9 months ago #28391

Hello,

'm Needing a little help with php and already googled a lot and could not do until now.

Next: Using the RSForm! and instead of using the Mapping functionality it offers, make the script Update (if the logged in user has already joined) and Insert (if not). This script is inserted in the "Script called on form process". Here do the tests and update or insert data in the database.
My problem is the following: I have 1 drop down form in which items are assigned through an array as 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 already registered, it's just right behind the data bank and populates the drop down. When not, it populates with the list for the user choice.

The problem is: how do I post on the seat selected in the drop down value?

Because if I just get this: $ estado_civil = $ _POST ;
It returns me an array and does not insert anything into the database.

Does anyone have a light?

PS: When I use the mapping functionality and do an INSERT, he usually inserts the data from the drop down on the bench. Do not use the Mapping because I need to test if I give an UPDATE or INSERT on the bench. And not figured out if it is possible to test this using this functionality.

Thank you in advance.
Last Edit: 10 years 9 months ago by alexp. Reason: english only
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!