我有多个复选框和onClick,我将向URL发送值,并从PHP中获取值,这样我就可以从查询中选择结果。
如果我选择市场美国和国际,那么网址是"product.php?market=US",但当我选择瓷砖和板,然后它显示"product.php?market=US-International&type=tiles&type=slabs",当我回到国际市场,然后它显示"product.php?market=US&type=tiles&type=slabs&market=International"
如何管理url中的get值,就像daraz.pk/women/clothing/kurtas-shalwar-kameez/在左边的过滤器上所做的那样。
复选框结构:
市场:
美国国际
类型:
瓷砖板
类别:
Oynyx等
CODE :
<div class="widgetTitle">
<h3 class="garis">Market</h3>
<div class="productsline"></div>
</div>
<nav class="categories">
<input name="check_list[]" onclick="window.location.href = '?market=Pakistan'" type="checkbox" id="checkbox-1" class="regular-checkbox" /><label for="checkbox-1"></label>
<input name="check_list[]" onclick="window.location.href = '?International&'" type="checkbox" id="checkbox-2" class="regular-checkbox" /><label for="checkbox-2"></label>
International
</nav>
</div>
<div class="widgetTitle">
<h3 class="garis">Type</h3>
<div class="productsline"></div>
</div>
<nav class="categories">
<input name="check_list[]" onclick="window.location.href = '&type=blocks'" type="checkbox" id="checkbox-3" class="regular-checkbox" /><label for="checkbox-3"></label>
Blocks
<input name="check_list[]" onclick="window.location.href = '<?=$path;?>&type=slabs'" type="checkbox" id="checkbox-4" class="regular-checkbox" /><label for="checkbox-4"></label>
Slabs
<input name="check_list[]" onclick="window.location.href = '&type=tiles'" type="checkbox" id="checkbox-5" class="regular-checkbox" /><label for="checkbox-5"></label>
Tiles
<input name="check_list[]" onclick="window.location.href = '&type=mosaics'" type="checkbox" id="checkbox-6" class="regular-checkbox" /><label for="checkbox-6"></label>
Mosaics
</nav>
</div>发布于 2013-11-13 08:50:56
您是用php或javascript构建url吗?
使用php:
$_GET['market'] = 'your new market';
echo http_build_query( $_GET );编辑后:
onClick="?<?php echo http_build_query( array('market' => 'Pakistan') + $_GET ); ?>"https://stackoverflow.com/questions/19949024
复制相似问题