I have three dropdowns and I can’t get data from two of them using POST, here is my code:
<form action="{url module=ProductManagement action=downloadFilteredImages}" method="post"> <table> <tbody> <tr> <td> <select class="form-control selectpicker filter" name="category_id" multiple data-live-search="true"> {foreach $suppliers as $supplier} <option value="{$supplier.supplier_id}" {if $value eq $supplier.supplier_id}selected{/if}>{$supplier.supplier_name}</option> {/foreach} </select> </td> <td> <select class="form-control selectpicker filter" name="category_id" multiple data-live-search="true"> <option value="0" selected>{t}Category filter{/t}</option> {include file="./ProductManagement_filters_category.tpl" categories=$categories} </select> </td> <td> <select class="form-control selectpicker filter" name="category_id" multiple data-live-search="true"> {foreach $order_statuses as $status} <option value="{$status.order_status_id}" {if $value eq $status.order_status_id}selected{/if}>{$status.order_status_name}</option> {/foreach} </select> </td> <td> <button type="submit" class="btn btn-primary"> {'Download'|t} </button> </td> </tr> </tbody> </table>
I can get the categoryID but not from the supplier or order status
Advertisement
Answer
All three select has same name attribute please change the values name=”category_id”
<select class="form-control selectpicker filter" name="category_id_1" multiple data-live-search="true"> {foreach $suppliers as $supplier} <option value="{$supplier.supplier_id}" {if $value eq $supplier.supplier_id}selected{/if}>{$supplier.supplier_name}</option> {/foreach} </select> </td> <td> <select class="form-control selectpicker filter" name="category_id_2" multiple data-live-search="true"> <option value="0" selected>{t}Category filter{/t}</option> {include file="./ProductManagement_filters_category.tpl" categories=$categories} </select> </td> <td> <select class="form-control selectpicker filter" name="category_id_3" multiple data-live-search="true"> {foreach $order_statuses as $status} <option value="{$status.order_status_id}" {if $value eq $status.order_status_id}selected{/if}>{$status.order_status_name}</option> {/foreach} </select>