psquillace Posted February 25, 2008 Share Posted February 25, 2008 Hello All: I am trying out a php script that involves sending checkboxes that people select to a mailing service called Constant Contact. For some reason, when you check multiple arrays only one option gets sent from that array... The last one checked... Can someone tell me if there is a limit an array or something like that. See, the array, when called lists all checkboxes that people can check but if someone checks more than one.... it does not pass or even get emailed because I have that in the script too. I would list the code here but it is 500 lines long with the HTML..... Thanks for any help or insight into this, Paul Link to comment https://forums.phpfreaks.com/topic/92830-passing-an-array-that-involves-checkboxes/ Share on other sites More sharing options...
p2grace Posted February 25, 2008 Share Posted February 25, 2008 The array size shouldn't be the problem. The syntax in your input tag should be like this though "name='check[]' or whatever name you want. But you need to have the brackets at the end. Let me know if that helps. Link to comment https://forums.phpfreaks.com/topic/92830-passing-an-array-that-involves-checkboxes/#findComment-475559 Share on other sites More sharing options...
psquillace Posted February 26, 2008 Author Share Posted February 26, 2008 hrmm well, when I call the array I have this <?php if (count($list_array) == '1') { echo "<tr><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><input type=\"hidden\" name=\"list_name[]\" value=\"" . $list_array[0] . "\"></td></tr>"; }else { foreach($list_array as $list_name) { $list_html .= "<tr><td valign=\"top\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><input type=\"checkbox\" name=\"list_name[]\" value=\"" . $list_name . "\"></td><td valign=\"top\" style=\"padding-top:6px;\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">" . $list_name."</td></tr>"; } echo "<b>Please Select Your Products of Interest:</b><br>" . $list_html; } ?> Do yo mean the list_name[] that i have, it should be list_name='[]' instead? thanks for your help, Paul Link to comment https://forums.phpfreaks.com/topic/92830-passing-an-array-that-involves-checkboxes/#findComment-476585 Share on other sites More sharing options...
DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 hrmm well, when I call the array I have this <?php if (count($list_array) == '1') { echo "<tr><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><input type=\"hidden\" name=\"list_name[]\" value=\"" . $list_array[0] . "\"></td></tr>"; }else { foreach($list_array as $list_name) { $list_html .= "<tr><td valign=\"top\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><input type=\"checkbox\" name=\"list_name[]\" value=\"" . $list_name . "\"></td><td valign=\"top\" style=\"padding-top:6px;\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">" . $list_name."</td></tr>"; } echo "<b>Please Select Your Products of Interest:</b><br>" . $list_html; } ?> Do yo mean the list_name[] that i have, it should be list_name='[]' instead? thanks for your help, Paul <?php if (count($list_array) == '1') { echo "<tr><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><input type=\"hidden\" name=\"list_name[]\" value=\"" . $list_array[0] . "\"></td></tr>"; }else { $i = 0; foreach($list_array as $list_name) { $list_html .= "<tr><td valign=\"top\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><input type=\"checkbox\" name=\"list_name[$i]\" value=\"" . $list_name . "\"></td><td valign=\"top\" style=\"padding-top:6px;\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">" . $list_name."</td></tr>"; $i++; } echo "Please Select Your Products of Interest: " . $list_html; } ?> see if that helps EDIT: forgot the ; after the $i++, I always do :-X Link to comment https://forums.phpfreaks.com/topic/92830-passing-an-array-that-involves-checkboxes/#findComment-476590 Share on other sites More sharing options...
psquillace Posted February 26, 2008 Author Share Posted February 26, 2008 Thanks DarkAngel for all your help with this, I was informed by the nice people at Constant Contact that they do not allow multiple sign ups with one pass of a script but only one entry per. Now I have to go back and recreate this script with a foreach loop or something..... :-\ At least I know it was nothing in my code so that is sort of comforting, Thanks again for all your help, Paul Link to comment https://forums.phpfreaks.com/topic/92830-passing-an-array-that-involves-checkboxes/#findComment-477423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.