I have the following code which loops through and creates an array of the sections. The problem with it is I am using the serviceid to define the array number. So instead of being event_services[0], event_services[1], event_services[2]. It is outputting like event_services[12], event_services[17], event_services[32].
How can I get it to output event_services[0], event_services[1], event_services[2]?
Code:
{section name=list_num loop=$services_list}
<INPUT type="hidden" name="event_services[{$services_list[list_num].serviceid}][serviceid]" value="{$services_list[list_num].serviceid}">
<INPUT type="hidden" name="event_service[{$services_list[list_num].serviceid}][product]" value="{$services_list[list_num].product}">
<TR bgColor="#E1E8EE">
<TD ><INPUT type="checkbox" name="event_service[{$services_list[list_num].serviceid}][add]" value="true"></TD>
<TD align="center"><INPUT type="text" name="event_service[{$services_list[list_num].serviceid}][amount]" align="right" size="2" value="{$services_list[list_num].min_amount}"></TD>
<TD class="ProductSelect">{$services_list[list_num].product}</TD>
<TD align="right" nowrap>${$services_list[list_num].price} (each)</TD>
</TR>
{/section}
If I write it like the following it seems like list_num is undefined, only ont he "name part though, the "value" part works great.
Code:
<INPUT type="hidden" name="event_services[{$list_num}][serviceid]" value="{$services_list[list_num].serviceid}">