close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Checkbox Group not saving correctly into database

Thread began 3/06/2019 7:04 pm by kata387222 | Last modified 3/07/2019 11:39 am by kata387222 | 47 views | 1 replies


Checkbox Group not saving correctly into database

Hi there
Having a wee problem with the result of a checkbox group entering as the word "Array" into database. I have tried imploding to comma seperate out the array and it worked but had issues exploding back in so we can check selections again for updating.

1. Why did the code generated by data assist for checkbox group not work in the first place
2. Do I need to hand code implode and explode to make it work.
3. If so please help with the explode

Here is my code (Used single checkbox data assist generated code and adapted it for array)

$UpdateQuery->bindColumn("FeaturesBox", "s", "".((isset($_POST["FeaturesBox"]))?implode(", ", $_POST["FeaturesBox"]):"") ."", "WA_BLANK");

<label class="checklabel" for="FeaturesBox"><input type="checkbox" name="FeaturesBox[]" id="FeaturesBox_1" value="1" class="formCheckboxField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("Productupdate","FeaturesBox"):"". in_array("1", explode(", ", $WADAProduct_update->getColumnVal("FeaturesBox"))).""),"1"))) {echo "checked=\"checked\"";} ?> tabindex="1" title="Please enter a value.">No</label>

<label class="checklabel" for="FeaturesBox_2"><input type="checkbox" name="FeaturesBox[]" id="FeaturesBox_2" value="2" class="formCheckboxField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("Productupdate","FeaturesBox"):"". in_array("2", explode(", ", $WADAProduct_update->getColumnVal("FeaturesBox"))).""),"2"))) {echo "checked=\"checked\"";} ?> tabindex="2" title="Please enter a value.">Yes</label>

Here is the original checkbox group data assist generated code (when executed it just has the words ARRAY in database)

$UpdateQuery->bindColumn("FeaturesBox", "s", "".((isset($_POST["FeaturesBox"]))?$_POST["FeaturesBox"]:"") ."", "WA_BLANK");

<label class="checkSublabel_Narrow" for="FeaturesBox__1">
yes&nbsp;<input type="checkbox" name="FeaturesBox[]" id="FeaturesBox__1" value="1" class="formCheckboxField_Standard" <?php if (array_search("1", ((isset($_GET["invalid"]) && ValidatedField("Productupdate2","FeaturesBox"))?ValidatedField("Productupdate2","FeaturesBox"):array())) !== false) {echo "checked=\"checked\"";} ?> tabindex="1" title="Please enter a value."></label>
<label class="checkSublabel_Narrow" for="FeaturesBox__2">
no&nbsp;<input type="checkbox" name="FeaturesBox[]" id="FeaturesBox__2" value="0" class="formCheckboxField_Standard" <?php if (array_search("0", ((isset($_GET["invalid"]) && ValidatedField("Productupdate2","FeaturesBox"))?ValidatedField("Productupdate2","FeaturesBox"):array())) !== false) {echo "checked=\"checked\"";} ?> tabindex="2"></label>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...