vendredi 20 novembre 2015

delete specific checkbox in php

My problem is, due to an array of pre-selected checkboxes, the user can mark the checkbox of a value he wants to delete, but my cicle only deletes de first one and ignores the POST I make to delete the specific one, here is the code:

if(isset($_GET['delete']))
{

for($i=0;$i<count($_SESSION['paymet']);$i++)
   {
     if(isset($_POST['payment']))
     {
      $_SESSION['payment'][$i] = "";

   for($j = $i; $j<count($_SESSION['payment']); $j++ )
   {
    if(isset($_SESSION['payment'][$j+1]))
    {
     $_SESSION['payment'][$j] = $_SESSION['payment'][$j+1];
   } 
   } 
 }
}

for($i=0;$i<count($_SESSION['payment']);$i++)
{
 if($_SESSION['payment'][$i] == NULL)
 {
  unset($_SESSION['foliopago'][$i]); 
 }
}

}




Aucun commentaire:

Enregistrer un commentaire