Update a field from Community Builder

Due to the flexible nature of RSform!Pro you can even update a field from a third party table. To do this, you will have to use a script, placed on the Scripts called on form process area:

 
// Get a database connection
$db    = JFactory::getDBO();
// Get the current logged-in user's data
$user  = JFactory::getUser();
 
// Setup the query
$db->setQuery("UPDATE #__comprofiler SET cb_audio1 = '".$db->escape($_POST['form']['audio'])."' WHERE user_id = '".$db->escape($user->id)."'");
// Execute it.
$db->query();
 

The above script will update a field named cb_audio1 from the _comprofiler table with the value got from a form value, named audio.

All fields in RSForm! Pro can be accessed through: $_POST['form']['NAME-OF-FIELD']. Replace NAME-OF-FIELD with the actual name (not caption!) of your RSForm! Pro field.

One person found this article helpful.


Was this article helpful?

Yes No
Sorry about that

You Should Also Read

Autopopulate a field from Community Builder HOT