Alessio Di Simone Alessio Di Simone - 3 days ago 4
HTML Question

Which data is sent via form?

Given an HTML form, such as a text field and two checkboxes, which data is provided through the form? For each element, is your data sent by id or name identifier or can it vary depending on the types of form elements?

In the specific case of two checkboxes, is the content of each one sent by its own ID or is it transmitted an array with the data of both by another identifier?

Zak Zak
Answer

Your form data is sent in an array via the name of each element.

So if you have a checkbox, the value of that checkbox will be the data sent. IE:

<input type="checkbox" name="vehicle" value="Toyota"> I have a car<br />

The array in, say, php can be seen with print-R($_POST);.