Alessio Di Simone Alessio Di Simone - 11 months ago 28
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 Source

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);.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download