vendredi 10 juillet 2020

PHP array from javascript checkboxes, Limit

I've come across a problem with limit of checked boxes in php array. it does not display more than 50. I need to get comma-separated string and when i check more than 50 boxes:

320,310,330,318,218,321,313,300,198,316,325,193,298,332,311,329,190,326,212,299,328,214,322,333,315,323,213,335,324,334,290,312,331,336,317,319,314,327,337,302,306,297,305,309,307,308,301,303,304,265,

empty after 50th comma. For example if i checked 4 boxes:

320,310,330,318

max_input_vars set to 2000 in php.ini

code:

 if($_REQUEST["smstoadd"])
  {
      $smsto = implode(",",$_REQUEST["smstoadd"]); 
  }
  else
  {
      $smsto = 0;
  }

<?    
$getPeopleSMS= mysql_query("SELECT * FROM `people` WHERE `cansms` ='1'
     ORDER BY `fullname` ASC");
                        while($getS = mysql_fetch_array($getPeopleSMS))
                        {
                    ?>  
                     <input id="is<?=$getS["id"]?>" name="smstoadd[]" type="checkbox" value="<?=$getS["id"]?>"
     />&nbsp;<label><?=$getS["fullname"]?></label><BR>
                    <?
                        }
                    ?>

$(document).ready(function(e) {
                   <?
                   if(strpos($smsto,",")!=0)
                        {
                        
                        $smsto = explode(",",$smsto);
                            foreach($smsto as $valuesm)
                            {
                        ?>
                            $("#is<?=$valuesm?>").attr("checked","checked");
                        <?
                            }
                       
                        }
                        else
                        {
                    ?>
                        $("#is<?=$smsto?>").attr("checked","checked");
                        <?
                        }
                        ?>
                });



Aucun commentaire:

Enregistrer un commentaire