The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Multi-options only save one choice - 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: Multi-options only save one choice (/showthread.php?tid=551) |
Multi-options only save one choice - kmw - Mar 6th, 2010 I have two checkboxes setup as a single option group. When I select either checkbox, the results save to the database. When I select both, nothing is saved. I have converted to multi-select with the same results. Manually editing the form submission gives the same result. I have enlarged the field size to no avail. I'm sure I must be doing something wrong, but I can't figure out what it is. RE: Multi-options only save one choice - Ben - Mar 7th, 2010 Hi kmw, Ah, this is one of those things that trips everyone up at some point. ![]() In your form, add "[]" after the name attribute for the checkboxes, like so: Code: <input type="checkbox" name="myfield[]" value="one" /> One PHP needs that to know that the checkbox is part of a group, and store all values. - Ben RE: Multi-options only save one choice - kmw - Mar 7th, 2010 Already done from the beginning: Code: <input type="checkbox" NAME="Request[]" value="Auto" /> Auto Insurance<br> If I edit the submission I can watch the problem happen before my eyes. Check one box, it stays checked after clicking 'update'. Add the other one, they both uncheck after update. RE: Multi-options only save one choice - Ben - Mar 7th, 2010 Heya, The only thing I can think of that would be causing this would be database field size, but you said you've already got that covered... what size is it at right now? Make sure it's at least 256 chars. Other than that I'm pretty stumped... - Ben RE: Multi-options only save one choice - kmw - Mar 9th, 2010 Never mind. I deleted the form and re-added it, and suddenly it works. Everything the same. Strange. Thanks for the responses. RE: Multi-options only save one choice - Ben - Mar 11th, 2010 Very strange. Eesh, stuff like this gets me worried. Do let me know if any other oddities crop up. - Ben RE: Multi-options only save one choice - gazoobajp - Jun 7th, 2020 Do you need group insurance springfield il? RE: Multi-options only save one choice - saeed20 - Jun 16th, 2020 HVAC San Diego |