mercredi 11 mars 2020

PHP how to insert checked data from a dynamic table to database

Below is the code for inserting the data, i am able to insert these records to the master table even if the checked box is unchecked but i only want to insert those data that are checked.

if (isset($_POST['deploy'])){
      if (isset($_POST['selected'])){
         if (isset($_POST["selected"])) {
             $checked = array();
             foreach($_POST["selected"] as $id => $val) {
                 $checked[] = addslashes($id);
             }
             $checked_list = implode(",", $checked);

             }
          }
        }



Aucun commentaire:

Enregistrer un commentaire