Jump to content

Passing an Array that Involves Checkboxes


psquillace

Recommended Posts

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.