We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48586
    • 78 Posts
    I have a checkbox set up in my form like:

    <input type="hidden" name="services[]" value="">
    
    <input type="checkbox" name="services[]" value="Surfing" id="surfing" [[!+fi.services:FormItIsChecked=`Surfing`]]>
    <div class="checklabel">Surfing</div>
                      
    <input type="checkbox" name="services[]" value="Wakeboarding" id="wakeboarding" [[!+fi.services:FormItIsChecked=`Wakeboarding`]]>
    <div class="checklabel">Wakeboarding</div>
    
    <input type="checkbox" name="services[]" value="Sailing" id="sailing" [[!+fi.services:FormItIsChecked=`Sailing`]]>
    <div class="checklabel">Sailing</div>
    


    And I have a custom snippet writing to an external database (that is writing all other values correctly), the line of code I am using for my "services" value is:

    $db_services = $hook->getValue('services');
    


    The issue I am having is that it is writing "Array" as the value to my database table. Could someone please help to get it to write out the full list of items checked.

    Thank you very much

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      $db_services = $hook->getValue('services');
      if (is_array($db_services)){
          $db_services = implode(',',$db_services);
      }
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 48586
        • 78 Posts
        Bruno17, once again you are my hero, thank you very much