CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Get Return Link from URL

Print topic Send  topic

Author Message
maxhugen

Posts: 272
Posted: 02/03/2009, 4:24 PM

I have a search + list page at www.gardenloco.com/res/index.php. When a user clicks on a garden Resource they go to a Detail page.

On this Detail page I have a link that returns to the search page. So users don't lose their previous search options, I set this link to $_SERVER['HTTP_REFERER'].

The Detail page also displays an "Edit" link (only to Admin users though), which takes them to an Edit page. I'm trying to pass a return link to the edit page, so that I can set a "Return to Search" link correctly.

In the Edit link on the Detail page, I added an extra URL parameter, RL=$_SERVER['HTTP_REFERER'].

My problem is that this return link may contain several URL parameters itself, eg:

http://www.gardenloco.com/res/index.php?ListOrder=Sorte...ame&ListDir=ASC

Thus, when I do CCGetParam("RL","") in the Edit page, I get only part of the "return link", eg:

http://www.gardenloco.com/res/index.php?ListOrder=Sorter_entity_name

As you can see, the "&ListDir=ASC" part is left off as it appears to be another URL parameter, rather than part of the parameter "RL".

Does anyone know of a method to sort of "encapsulate" the RL parameter so that I can get the full return link pls?

MTIA

_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
maxhugen

Posts: 272
Posted: 02/04/2009, 4:10 PM

Still stuck on this... any ideas would be most appreciated! :-/
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
damian

Posts: 838
Posted: 02/05/2009, 4:03 AM

not sure how to do it your way but a javascript link goes like this:
<a href="javascript: history.go(-1)">Back To Search results</a>
or button like this:
<form><input type="button" value=" Back To Search Results" onclick="history.go(-1);return false;" /></form> [/code  
you can go back 2 pages by changing to -2 etc....  
  
 
                  
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
datadoit
Posted: 02/05/2009, 6:59 AM

Simplest way I can think of is to add a URL parameter to your grid link
of 'ret_link'.

Under Parameters for the link, add:

ret_link

with a value of "YourPage.php" (make certain to put it in quotes,
otherwise it'll chop off at the dot)

On the second detail page, set your return link to
CCGetParam("ret_link"), making certain to remove the ret_link parameter
under Parameters to Remove.
maxhugen

Posts: 272
Posted: 02/05/2009, 2:05 PM

@damian, thanks for the suggestion. I hadn't thought of history.go(-2), but I prefer a specified URL, in case someone gets to the Detail page from Google, or a link on a different site etc.

@datadoit, thanks, but unfortunately that won't work, because the return URL may have ampersands in it, so CCGetParam can't recognise the full ret_link.

At the moment, I use a Label in the return URL on the Detail page, which I set to $_SERVER['HTTP_REFERER'] if it came from the Search page, otherwise I assume it came from an external link, so I set it to the Search page without any parameters. That works really well.

It's probably a bit unusual to try to get directly back to the Search (with it's parameters) from a "second hop", the Edit page. I'm doing that as a convenience to Administrators.
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
datadoit
Posted: 02/05/2009, 3:21 PM

There's no need to use HTTP_REFERER. This is the exact same in
CodeCharge speak:

global $FileName;
$http_referer = $FileName . "?" . CCGetQueryString("QueryString","");

I think your problem is occurring by trying to shove everything you need
in the -sending- link, as opposed to retrieving everything you need in
the -receiving- page. When you get to your Edit page, capture that
ret_link along with the query string so that you can build your return
link accordingly.

$qs = CCGetQueryString("QueryString","");
$qs = CCRemoveParam($qs, "ret_link");
$Component->SetLink(CCGetParam("ret_link","")."?".$qs);
damian

Posts: 838
Posted: 02/06/2009, 2:13 AM

i didnt quite understand datadoit's post (not his fault!) but i do grab the variables to show/hide panels in other pages....

you know what all your variable options are so grab them with

CCGetParam(name, value)


_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.