mardi 4 mai 2021

How can I further format the response I get from a standard HTML checklist?

I hope you are good!

I built this piece of code, which results in the following design of a checklist, in which I am able to select multiple items from a list -

<!DOCTYPE html>
<html>
<body>

<h1>Show Checkboxes</h1>

<form action="/action_page.php">
  <input type="checkbox" id="item1" name="item1" value="Tshirt">
  <label for="item1"> Tshirt</label><br>
  <input type="checkbox" id="item2" name="item2" value="Jeans">
  <label for="item2"> Jeans</label><br>
  <input type="checkbox" id="item3" name="item3" value="Shirt">
  <label for="item3"> Shirt</label><br>
  <input type="checkbox" id="item4" name="item4" value="Trousers">
  <label for="item4"> Trousers</label><br><br>
  <input type="submit" value="Submit">
</form>

</body>
</html>

The checklist I get :

my checklist

And when I choose some items and click submit [for this time I chose Jeans & Trousers], I get my response in this format : item2=Jeans&item4=Trousers. Unfortunately, I cannot further work with this kind of response format...

The format I need should be more like : Jeans , Trousers. No item-ids, and no = signs - just their display names... Is it possible to get a response like that?

Any help would be appreciated! Thanks a lot! 🙂

Edit : Here's the code I took inspiration from - https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_checkbox




Aucun commentaire:

Enregistrer un commentaire