How to make group of checkboxes with one line results in templates?

Top  Previous  Next

To make a group of checkboxes you need to give them names like interests[index](as it shown in the example),where index-field index, starting from “1”

Example:

 

<table>

<tr>

<td>

<label>

<input type="hidden" value="" name="interests[1]">

<input type="checkbox" name="interests[1]" value=" Finance News" checked>Finance News

</label>

</td>

<td>

<label>

<input type="hidden" value="" name="interests[2]">

<input type="checkbox" name="interests[2]" value="Chat" checked>

Chat

</label>

</td>

</tr>

<tr>

<td>

<label>

<input type="hidden" value="" name="interests[3]">

<input type="checkbox" name="interests[3]" value="Weather">Weather

</label>

</td>

<td>

<label>

<input type="hidden" value="" name="interests[4]">

<input type="checkbox" name="interests[4]" value="Other" checked>Other

</label>

</td>

</tr>

</table>

In future to receive data from this group of checkboxes and to acquire the list of comma-separated values of checked checkboxes we use {#interests#} form.

 

Result (if we check first, second and forth fields):

 

Finance News, Chat, Other