我有一張表,我列出了所有產品並在表格中通過我過濾產品,現在我面臨的問題是我已經提取了SQL中的所有數據,並且我想知道在過濾參數時如何形成新表格。如何通過Post方法在php中的表中獲取值並獲取表中的替換前表
<div class="row">
<div class="col-md-12">
<!-- Begin: life time stats -->
<div class="portlet light">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Products
</div>
<div class="actions">
<div class="btn-group">
<a class="btn default yellow-stripe dropdown-toggle" href="javascript:;" data-toggle="dropdown">
<i class="fa fa-share"></i> Tools <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right">
<li>
<a href="javascript:;">
Export to Excel </a>
</li>
<li>
<a href="javascript:;">
Export to CSV </a>
</li>
<li>
<a href="javascript:;">
Export to XML </a>
</li>
<li class="divider">
</li>
<li>
<a href="javascript:;">
Print Invoices </a>
</li>
</ul>
</div>
</div>
</div>
<div class="portlet-body">
<div class="table-container">
<div class="table-actions-wrapper">
<span>
</span>
<select class="table-group-action-input form-control input-inline input-small input-sm">
<option value="">Select...</option>
<option value="publish">Publish</option>
<option value="unpublished">Un-publish</option>
<option value="delete">Delete</option>
</select>
<button class="btn btn-sm yellow table-group-action-submit"><i class="fa fa-check"></i> Submit</button>
</div>
<table class="table table-striped table-bordered table-hover" id="datatable_products">
<thead>
<tr role="row" class="heading">
<th width="1%">
<input type="checkbox" class="group-checkable">
</th>
<th width="10%">
Product ID
</th>
<th width="15%">
Product Name
</th>
<th width="15%">
Category
</th>
<th width="10%">
Price
</th>
<th width="10%">
Stock
</th>
<th width="15%">
SKU
</th>
<th width="10%">
Status
</th>
<th width="10%">
Product Image
</th>
</tr>
<tr role="row" class="filter">
<form method="post" action="productlist.php" id="searchform">
<td>
</td>
<td>
<input type="text" class="form-control form-filter input-sm" id="product_id" name="product_id">
</td>
<td>
<input type="text" class="form-control form-filter input-sm" name="product_name">
</td>
<td>
<select name="product_category" class="form-control form-filter input-sm">
<option value="">Select...</option>
<option value="1">Mens</option>
<option value="2"> Footwear</option>
<option value="3"> Clothing</option>
<option value="4"> Accessories</option>
<option value="5"> Fashion Outlet</option>
<option value="6">Football Shirts</option>
<option value="7"> Premier League</option>
<option value="8"> Football League</option>
<option value="9"> Serie A</option>
<option value="10"> Bundesliga</option>
<option value="11">Brands</option>
<option value="12"> Adidas</option>
<option value="13"> Nike</option>
<option value="14"> Airwalk</option>
<option value="15"> USA Pro</option>
<option value="16"> Kangol</option>
</select>
</td>
<td>
<div class="margin-bottom-5">
<input type="text" class="form-control form-filter input-sm" name="product_price_from" placeholder="From"/>
</div>
</td>
<td>
<div class="margin-bottom-5">
<input type="text" class="form-control form-filter input-sm" name="product_quantity_from" placeholder="From"/>
</div>
</td>
<td>
<div class="input-group date date-picker margin-bottom-5" data-date-format="dd/mm/yyyy">
<input type="text" class="form-control form-filter input-sm" readonly name="product_created_from" placeholder="From">
<span class="input-group-btn">
<button class="btn btn-sm default" type="button"><i class="fa fa-calendar"></i></button>
</span>
</div>
</td>
<td>
<select name="product_status" class="form-control form-filter input-sm">
<option value="">Select...</option>
<option value="published">Complete</option>
<option value="published">Cancelled</option>
<option value="published">Denied</option>
<option value="published">Failed</option>
<option value="notpublished">Refund</option>
<option value="notpublished">Shipped</option>
<option value="notpublished">Delivered</option>
<option value="deleted">Reversed</option>
</select>
</td>
<td>
<div class="form-actions">
<div class="margin-bottom-5">
<input type="hidden" name="validate">
<button class="btn btn-sm yellow filter-submit margin-bottom" name="search" type="submit"><i class="fa fa-search"></i>Search</button>
</div>
<button class="btn btn-sm red filter-cancel" type ="reset"><i class="fa fa-times"></i> Reset</button>
</div>
</td>
</form>
</tr>
</thead>
<tbody>
<?php
global $conn;
$result = mysqli_query($conn,"SELECT * FROM nits_product");
while ($record = mysqli_fetch_array($result)) {
echo '<tr role="row">';
echo '<td width="1%"><input type="checkbox" class="group-checkable"></td>';
echo'<td data-th="Product ID">' . $record['product_id'] . '</td>';
echo'<td data-th="Product Name">' . $record['product_name'] . '</td>';
echo'<td data-th="Category">' . $record['product_categories'] . '</td>';
echo'<td data-th="Price">' . $record['product_price'] . '</td>';
echo'<td data-th="Stock">' . $record['product_stock'] . '</td>';
echo'<td data-th="SKU">' . $record['product_sku'] . '</td>';
echo'<td data-th="Status">' . $record['product_status'] . '</td>';
echo'<td data-th="Product Image">' . $record['product_images'] . '</td>';
echo '</tr>';
}?>
</tbody>
</table>
</div>
</div>
</div>
<!-- End: life time stats -->
</div>
</div>
在此先感謝!
你想刷新頁面? –
不需要。我想根據搜索查詢將表與新數據項綁定。 –