mardi 4 décembre 2018

NEED HELP ! Checkbox in update with array

I want to update a checkbox and when I choose my choice in a checkbox, I can't see them checked in my page update.

 <?php 
     $chkbox=$res['arg'];
     $arrg=explode(",",$chkbox);
  ?>
  <input <?php if(in_array("FootBall",$arrg)){echo "checked";}?> type="checkbox" name="arg[]" value="FootBall"/>FootBall
  <input <?php if(in_array("HandBall",$arrg)){echo "checked";}?>  type="checkbox" name="arg[]" value="HandBall"/>HandBall
  <input <?php if(in_array("Marche",$arrg)){echo "checked";}?> type="checkbox" name="arg[]" value="Marche"/>Marche
  <input <?php if(in_array("Natation",$arrg)){echo "checked";}?> type="checkbox" name="arg[]" value="Natation"/>Natation
  <input <?php if(in_array("Equitation",$arrg)){echo "checked";}?> type="checkbox" name="arg[]" value="Equitation"/>Equitation
  <input <?php if(in_array("Rugby",$arrg)){echo "checked";}?> type="checkbox" name="arg[]" value="Rugby"/>Rugby
  <input <?php if(in_array("Esport",$arrg)){echo "checked";}?>  type="checkbox" name="arg[]" value="Esport"/>Esport

I'm actualy using this and I don't know where is the problem.




Aucun commentaire:

Enregistrer un commentaire