mercredi 8 juillet 2015

keeping multiple checkboxes checked in foreach loop in php

I have multiple checkboxes within a foreach loop and I need to keep the selected checkboxes checked after the form submission. The code is as below. Please help.

     <? $i=0;
        while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
        {
          foreach($row=$val)
          {
            $id="chkbox".$i;
      ?>
          <input type="checkbox" name="chkbx" onclick ="func()" id="<?echo   $id;">? value="<?echo $val \n;?>" <? echo "$val";?>

Now where and how to include the checked property of the boxes..




Aucun commentaire:

Enregistrer un commentaire