1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Saving data from Form with multi-checkboxes to DB

Discussion in 'Community' started by crierc, Apr 7, 2020.

  1. crierc

    crierc New Member

    Level: Community
    Hi all,
    Excuse me if I take advantage of this forum to ask for help for a need of mine, which is currently blocking my work.
    I'm not very familiar with PHP programming and so far I've used Fabrik with his out of the box features.

    I have a form with 3 fields containing a value each and 1 field with a multiple check-box list.
    I need the PHP code to save the data on another table.

    1 record for each valorized checkbox: the first 3 fields are the same for all, in the 4th field goes the content of each selected checkbox.

    I hope I have been clear and thank you in advance

    Looking forward to hearing from you.


  2. lousyfool

    lousyfool Active Member

    Level: Community

    Sounds like you want to use the PHP form plugin. Check the Wiki, there is a lot on location/trigger, how to access form data, even how to save to another table, etc: http://fabrikar.com/forums/index.php?wiki/php-form-plugin/

    Of course, we won't be able to teach you PHP here, but the Wiki and Google do help, and so should this: https://docs.joomla.org/Inserting,_Updating_and_Removing_data_using_JDatabase
    And possibly this: https://docs.joomla.org/Selecting_data_using_JDatabase

    To see why your code doesn't work, set Joomla error reporting to max. To see what you're having as variables (values, arrays), use the standard PHP methods such as "echo" or "return", "var_dump", "print_r" -- followed by an "exit".

    If you have specific questions, please post your code here along with all what/why/where/how details we need to be able to understand.
    Last edited: Apr 8, 2020
  3. crierc

    crierc New Member

    Level: Community
    Hi and many thanks for your kind suggestion.

    I used upsert plugin instead of form plugin and now I'm able to save data to the table but just for one array field (see attached picture field higlighted in blue) I have the wrong data, I mean not the name displayed in the form but his ID.

    Any suggestion?

    Thank you in advance



    Attached Files:

  4. crierc

    crierc New Member

    Level: Community
    Hi again,

    finally I've succeeded in fetching data from checkboxes but now when I submit the form and by upsert plugin other MySql table should be updated, I receive this error message: Unknown column '' in 'where clause'

    Where I have to check to fix this issue?

    Thank you in advance



Share This Page