vendredi 20 décembre 2019

Is there a way to get an array of ticked checkboxes from a form using the GET method? PHP

I am trying to get an array of all ticked values from the GET form in php. Currently the value that is returned by doing $_GET['cat'] is the last value ticked as a string.

<form method='get' action='/products.php'>
  <p class='rob-font my-0'>
     <input type='checkbox' name='cat' value='Spirits' class='mr-1'>Spirits
  </p>

  <p class='rob-font my-0'>
     <input type='checkbox' name='cat' value='Liqueurs' class='mr-1'>Liqueurs
  </p>

  <p class='rob-font my-0'>
     <input type='checkbox' name='cat' value='Wine' class='mr-1'>Wine
  </p>
</form>

I have found many solutions for this using a POST form, but I am trying to do it with a GET form.




Aucun commentaire:

Enregistrer un commentaire