I need help with filtering out results from saved forms in Formbrowser.
I have tried but can´t seem to get it to work. As you probably will see I´m not used to code in PHP but I have given it a try :)
This is what I would like to do:
1. Filter out all the saved data from a field called Units.
2. Sum up all the units where the data in field Status is Levande
3. Show the result on my webpage.
I have 2 problems with the code right now.
1. I can´t get the sum to show.
2. If I could it would show the sum as many times as the field Status contains the data Levande, and I would like to show the result just 1 time.
This is the code in my template for the actual request:
Code: Select all
{foreach from=$list item=entry}
{foreach from=$entry->fields item=status}
{if $status == Levande}
{section name=vals start=0}
{if isset($entry->fields[$smarty.section.vals.index])}
<td>
Levande units: {units}
</td>
{else}
<td></td>
{/if}
{/section}
{/if}
{/foreach}
{/foreach}
Code: Select all
$summa = 0;
$u = $entry->fields[4];
$totalt = $summa + $u;
echo $totalt;
Melker