使用 post 从表单获取数据
Get data from a form using post
我有三个下拉菜单,但我无法使用 POST 从其中两个中获取数据,这是我的代码:
<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>
我可以获取 categoryID 但不能从供应商或订单状态获取
所有三个 select 具有相同的名称属性,请更改值 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>
我有三个下拉菜单,但我无法使用 POST 从其中两个中获取数据,这是我的代码:
<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>
我可以获取 categoryID 但不能从供应商或订单状态获取
所有三个 select 具有相同的名称属性,请更改值 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>