tqla Posted September 15, 2008 Share Posted September 15, 2008 There is a form processing script that I am NOT allowed to modify. In this case it puts selected checkbox items into a field called Custom5. The problem here is that it only puts the last checked item from this form element into Custom5. Here is my question. Is there a way to add all of the checkbox selections together and send them as a value for Custom5? <table width="100%" border="0" cellpadding="0"> <tr> <td> <input type="checkbox" name="Custom5" value="Data Analytics"/>Data Analytics </td> </tr> <tr> <td><input type="checkbox" name="Custom5" value="Market Research"/>Market Research </td> </tr> <tr> <td><input type="checkbox" name="Custom5" value="New Branding Campaign"/>New Branding Campaign </td> </tr> <tr> <td><input type="checkbox" name="Custom5" value="Promotions"/>Promotions </td> </tr> <tr> <td><input type="checkbox" name="Custom5" value="Interactive/eMarketing"/>Interactive/eMarketing </td> </tr> <tr> <td><input type="checkbox" name="Custom5" value="Nothing specific right now"/>Nothing specific right now </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/124363-form-help/ Share on other sites More sharing options...
Maq Posted September 15, 2008 Share Posted September 15, 2008 Yes, put them in an array. Quote Link to comment https://forums.phpfreaks.com/topic/124363-form-help/#findComment-642251 Share on other sites More sharing options...
tqla Posted September 15, 2008 Author Share Posted September 15, 2008 Can you give me an example? Remember I can not modify the form processing script. I can just send the value of Custom5 to it. Quote Link to comment https://forums.phpfreaks.com/topic/124363-form-help/#findComment-642259 Share on other sites More sharing options...
kenrbnsn Posted September 15, 2008 Share Posted September 15, 2008 Speak to whomever designed the form and get them to correct it. The way that it is written, it will only return the last box checked, since they are all named the same. Ken Quote Link to comment https://forums.phpfreaks.com/topic/124363-form-help/#findComment-642277 Share on other sites More sharing options...
tqla Posted September 15, 2008 Author Share Posted September 15, 2008 I can rename them easily. It's the processing script that I can't modify (it's part of a bigger system). What I need to do is find a way to combine all of the checkbox values into one and then call it Custom5. So I can rename them to cb1, cb2, cb3, and so on and then combine all of the ones that are checked into on hidden field called Custom5. But how??? Quote Link to comment https://forums.phpfreaks.com/topic/124363-form-help/#findComment-642287 Share on other sites More sharing options...
kenrbnsn Posted September 15, 2008 Share Posted September 15, 2008 Change the form to <input type="hidden" name="Custom5[1]" value="not checked"> <input type="hidden" name="Custom5[2]" value="not checked"> <input type="hidden" name="Custom5[3]" value="not checked"> <input type="hidden" name="Custom5[4]" value="not checked"> <input type="hidden" name="Custom5[5]" value="not checked"> <input type="hidden" name="Custom5[6]" value="not checked"> <table width="100%" border="0" cellpadding="0"> <tr> <td> <input type="checkbox" name="Custom5[1]" value="Data Analytics"/>Data Analytics </td> </tr <tr> <td><input type="checkbox" name="Custom5[2]" value="Market Research"/>Market Research </td> </tr> <tr> <td><input type="checkbox" name="Custom5[3]" value="New Branding Campaign"/>New Branding Campaign </td> </tr> <tr> <td><input type="checkbox" name="Custom5[4]" value="Promotions"/>Promotions </td> </tr> <tr> <td><input type="checkbox" name="Custom5[5]" value="Interactive/eMarketing"/>Interactive/eMarketing </td> </tr> <tr> <td><input type="checkbox" name="Custom5[6]" value="Nothing specific right now"/>Nothing specific right now </td> </tr> </table> The processing script will see an array called Custom5 with the values. Ken Quote Link to comment https://forums.phpfreaks.com/topic/124363-form-help/#findComment-642292 Share on other sites More sharing options...
tqla Posted September 15, 2008 Author Share Posted September 15, 2008 Hi Ken. Thanks but all that shows up in the database field is the word "Array". So the Array is there but How do I get it? Any suggestions? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/124363-form-help/#findComment-642328 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.