首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP获取URL错误

PHP获取URL错误
EN

Stack Overflow用户
提问于 2013-11-13 08:38:14
回答 1查看 122关注 0票数 0

我有多个复选框和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等

代码语言:javascript
复制
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>
EN

回答 1

Stack Overflow用户

发布于 2013-11-13 08:50:56

您是用php或javascript构建url吗?

使用php:

代码语言:javascript
复制
$_GET['market'] = 'your new market';

echo http_build_query( $_GET );

编辑后:

代码语言:javascript
复制
onClick="?<?php echo http_build_query( array('market' => 'Pakistan') + $_GET ); ?>"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19949024

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档