Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #7616
      pierre
      Participant

      Hi,

      I tried to create a checkbox list with the French States :


      piklist('field', array(
      'type' => 'checkbox'
      ,'field' => 'dept_distributeur'
      ,'label' => 'Département'
      ,'choices' => array(
      "01" => "01 - Ain"
      ,"02" => "02 - Aisne"
      ,"03" => "03 - Allier"
      ,"04" => "04 - Alpes-de-Haute-Provence"
      )
      ));

      But when I check more than 1 checkbox, only one is saved : the highest.
      For example, when I check 01, 02 and 04, only 04 is saved on my custom post.

      What am I doing wrong ?
      Thanks.

    • #7632
      Steve
      Keymaster

      @pierre– Welcome to the Piklist community!

      Your code works fine for me. A few things:

      1) Make sure you haven’t created another field with the same name by accident.
      2) You may also want to try this: https://piklist.com/learn/doc/arent-fields-saving/

    • #7637
      pierre
      Participant

      @Steve,

      I checked these two points and disabled all my other plugins but I still have the same problem.

      I don’t know where is the problem. I already made a checkbox list with Piklist for another project and everything works well (same server, same configurations…). I compared all my files with this project and everything seems to be OK.

      Some parts of my phpinfo file :
      PHP 7.0.13
      memory_limit : 256M
      post_max_size : 64M

      Any other idea of what could be the problem ?
      Thank you !

    • #7647
      pierre
      Participant

      I found my problem origin !

      In fact, my theme doesn’t allow multiple checkbox saving in database… But I don’t know why. I’m using Hind (child)theme (https://themeforest.net/item/hind-multiconcept-portfolio-wordpress-theme/12643880).

      Do you have an idea of what could be causing this problem ?
      For me, this theme is blocking multiple meta_key saving with the same name. Is it possible ?

      Thanks.

    • #7659
      Steve
      Keymaster

      @pierre– Anything is possible with WordPress! 😉

      Don’t worry, Piklist has your back. In the Piklist Demos check out COMMON (tab) > LISTS > CHECKBOXES. You want to look at the GROUP LISTS field. It’s setup so your checkbox data will save in ONE field as an array.

      Just and FYI, this is one of the reasons people stay away from these all-in-one themes… they do too much and take over your site.

    • #7676
      pierre
      Participant

      @Steve,
      Indeed, the group list solved my problem. It works well now !

      Thank you so much for your help 😀

Viewing 5 reply threads
  • The topic ‘Impossible to save multiple checkbox’ is closed to new replies.