The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
When submitting form checkboxes do not show - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: When submitting form checkboxes do not show (/showthread.php?tid=302)



When submitting form checkboxes do not show - James - Sep 25th, 2009

Hi there,

I am not the most advanced here by a long shot so this is why im posting here. The problem i have is in my form i have a long list of checkboxes, but when the form is submitted it is only displaying one of the chosen checkboxes and not all of the chosen ones.

This was happening to me in formtools 1.5 and 2, i was looking in the other forum and a user had a similar problem which ben said was down to arrays and that adding a [] at the end should solve this but i have tried that and still no luck Sad

Does anyone have any ideas ?


RE: When submitting form checkboxes do not show - Jaace - Sep 25th, 2009

Same here. This happens for dropdowns as well. I used print_r($fields) on my success/thank you page too and I see that these fields get here...just not saved to the database for some reason.

I'm looking into it and I'll post back if I find anything.
Well, if Form Tools 2 is behaving the same way it is for me as it is for you currently...I couldn't use Smart Fill...but that wasn't a huge concern for me since I like to know what EVERYTHING is doing and not let things get automagically done for me.

On that note, I skipped Smart Fill when creating my form, as you probably did as well, which is why this problem is occuring (I think). Because I skipped Smart Fill, I also didn't get set up with Field Option Groups automatically. I just set one up for the Amount dropdown on the donation form example. For info on how to do this http://docs.formtools.org/userdoc/?page=fog_adding_manually

This should take care of it. It did for me :-)

Also, you should realize that while Smart Fill will automatically set up dropdowns for you (when it works at all), it will not do the same for Checkboxes or Radio Buttons, as discussed here.


RE: When submitting form checkboxes do not show - Ben - Sep 26th, 2009

Hey guys,

This is actually a PHP-ism. Whenever you have a single form field name that's being used to submit multiple values, e.g. a multi-select dropdown or a series of checkboxes, you need to tack on the characters "[]" to the end of the name attribute to let the server know. Here's how the HTML would look:

Code:
<select name="myfield[]" multiple size="3">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
</select>

<input type="checkbox" name="myfield2[]" value="1" /> 1
<input type="checkbox" name="myfield2[]" value="2" /> 2
<input type="checkbox" name="myfield2[]" value="3" /> 3
<input type="checkbox" name="myfield2[]" value="4" /> 4

Hope this helps!

- Ben


RE: When submitting form checkboxes do not show - Jaace - Sep 26th, 2009

Weird, on my install with the donate example, the characters "[]" are not either the state or amount dropdowns and they work perfectly as long as I use set up field groups on the form tools admin panel. Are these getting added somewhere else I'm not seeing?


RE: When submitting form checkboxes do not show - Ben - Sep 26th, 2009

Hey Jaace,

Ah! For single dropdowns, like state or amount, it'll work fine without them. It's just with the multiple select box that this becomes an issue.

- Ben


RE: When submitting form checkboxes do not show - James - Sep 26th, 2009

So how would that look for when multiple checkboxes are being used?

I have tried that before but I'm obviously doing something wrong.


RE: When submitting form checkboxes do not show - Ben - Sep 26th, 2009

Hey James,

If you have multiple checkboxes with the same name attribute (i.e. it's related data and you want to store the info in one field), you'd write the HTML as with my example above. If you have multiple checkboxes and the data is NOT related, you'd use separate name attributes.

Hope this is kinda clear...!

- Ben


RE: When submitting form checkboxes do not show - James - Sep 28th, 2009

Hi Ben,

I have tried exactally the same as how you have it above with the [] in the name field but still when i submit the form only 1 or 2 of the sometimes 6 selected checkboxes show as being selected. Not really sure what else to try. Any ideas?


RE: When submitting form checkboxes do not show - Ben - Sep 28th, 2009

Hi James,

It sounds like maybe the allocated space for the field isn't large enough. Try going to Edit Form -> Advanced tab, and increase the space for the field (say to "Large" or something). That will ensure there's enough space in the database to store all checked checkbox values.

- Ben


RE: When submitting form checkboxes do not show - James - Sep 28th, 2009

You are the man ben!

That works great now. Something so simple yet i've never thought to change that for checkboxes.

Thank you so much for your help!