Forums

Saving to multiple databases conditionally

phpcoder 15 May, 2015
I have a form that has an important field named type. Type can take two values: Fruit or Vegetable. Then all the other fields follow in the form.

Suppose Fruit is selected, data should be stored in DB named db_fruit. If Vegetable is selected, data should be stored in DB named db_vegetable. The tables in these two DB will have the same schema.

Joomla site itself is associated with a different DB where the form is designed via the Chronoforms admin component.

Is this possible? Please guide me.
GreyHead 15 May, 2015
Hi phpcoder,

You can't dynamically select a table name in CFv5 but you an use an event switcher with two events 'fruit' and 'veg' say and add a DB Save to each event linked to the appropriate table. That should work OK.

Bob
This topic is locked and no more replies can be posted.