根据页面重定向的位置显示/隐藏 div 部分? [英] show/hide div section based on where the page is redirected from?

查看:56
本文介绍了根据页面重定向的位置显示/隐藏 div 部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个像这样重定向的 php 文件

I have two php files which redirect like this

`header('Location: usrsecuredpage.php?div=subscription');`
`header('Location: usrsecuredpage.php?div=stusearch');`

在usrsecuredpage.php"上,我在页面上有一些显示和隐藏 div 部分的 javascrip 切换链接.这是代码:

On the "usrsecuredpage.php" I have a few javascrip toggle links on page which show and hide div sections. this is the code:

<li><a href="javascript:toggle('subscription')"><b>Subscription Details</b></a></li>
<li><a href="javascript:toggle('stusearch')"><b>Personal Information</b></a></li>

点击订阅切换链接会显示订阅详细信息并隐藏个人信息,反之亦然..

clicking the subscription toggle link shows subscription detail and hides personal information and vise versa..

我希望由 php 页面提供的标题自动显示相关的 div 部分.例如,当从 php 页面收到 header header('Location: usrsecuredpage.php?div=subscription'); 时,我希望订阅详细信息部分切换并显示..

I would like the headers being supplied by php pages to automatically show relevant div section. for example when header header('Location: usrsecuredpage.php?div=subscription'); is received from php page i would like subscription detail section to toggle and show up..

我该怎么做?

推荐答案

向您的 URL 添加查询字符串参数,并让页面根据查询字符串参数显示或隐藏 div.

Add a query string parameter to your URL and have the page show or hide the div based on the query string parameter.

例如

header('Location: usrsecuredpage.php?ShowDiv=true');

然后,在结果页面中,您可以使用全局变量 $_GET 检查该变量的值,如下所示:

Then, in the resulting page, you can check the value of that variable by using the global variable $_GET, like this:

$_GET['ShowDiv']

使用此变量,您可以相应地显示或隐藏 div.如果我能提供更多详细信息,请告诉我...

Using this variable, you can show or hide the div accordingly. Let me know if I can provide any more detail...

这篇关于根据页面重定向的位置显示/隐藏 div 部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆