I have list of Materials as drop down in each row of table (100 rows). I want to selectively assign any row selected material.
For example, suppose $materialoptions is assigned an array (1=>'Material 1', 2=>'Material 2',3=>'Material 3'). This is list of dropdown in each row.
I want to assign in php say, In row 20, material selected is 'Material 2'.
Below is my implementation. Not able to assign properly. HTML/Smarty Code
<form name='materialsel' id='materialsel' method='POST' action=''>
<table>
{section name=counter start=1 loop=100 step=1}
<tr>
<td><SELECT name="materialid_{$smarty.section.counter.index}" id="materialid_{$smarty.section.counter.index}" onchange='return document.forms.materialsel.submit();'><option value='0'>Select Material</option>
{html_options selected=$material_$smarty.section.counter.index options=$materialoptions}
</SELECT>
</td>
</tr>
{/section}
</table>
</form>
PHP Code
$smarty->assign("materialoptions", array (1=>'Material 1', 2=>'Material 2',3=>'Material 3'));
//In row 20, material selected is 'Material 2'
$smarty->assign("material_20",2); //Not able to do this