mercredi 28 mars 2018

Get all unchecked boxes value

I wanted to ask if it is possible with php to show all checkboxes value that is empty efter the form have been submited.

Right now i get all the non empty values like this wich i understand but i want to do the apposite:

enter image description here

Code:

 <form method="post" action="">
<input type="checkbox" name="cars[]" value="Bmw">Bmw
<input type="checkbox" name="cars[]" value="Audi">Audi
<input type="submit">

if(empty($_POST['cars'])){
  echo "<pre>";
  var_dump($_POST['cars']);
  echo "</pre>";


}




Aucun commentaire:

Enregistrer un commentaire