View Full Version : Distinguishing data on URL data passing
I need to pass a URL string from one page to another, eg:
http://server/page.php?redir=http://server/anotherpage.php
...that works fine, but when there is more data involved things go a little strange:
http://server/page.php?redir=http://server/anotherpage.php?somedata=1&somemoredata=2
How can you distinguish to which page 'somemoredata' belongs to?
whammy
09-14-2002, 07:10 AM
If you want to do it like that, your best bet might be to split the querystring into an array to parse out the data...
And how might that be done?
whammy
09-16-2002, 03:58 PM
Hmm... actually upon reading your question, I'm not sure what you mean. If you mean what is redir:
redir = Request.QueryString("redir")
will give you whatever is after the ? in the querystring. If on the other hand, you mean where did you originally obtain the data, there is no way to tell unless you want the referring page...
referringpage = Request.ServerVariables("HTTP_REFERER")
would give you that.
If I'm on the wrong track, please explain your question again?
:)
When I ask for:
Request.QueryString("redir")
.. I would have liked it to return:
http://server/anotherpage.php?somedata=1&somemoredata=2
is there some way of controling (like parentheses in formuee) to what '&somemoredata=2' belongs to. Eg:
http://server/page.php?(redir=http://server/anotherpage.php?somedata=1&somemoredata=2)
..and if I were to give 'anotherpage.php' a redirect URL (from 'page.php') I could do somthing like this:
http://server/page.php?(redir=http://server/anotherpage.php?somedata=1&somemoredata=2&redir=(redir=http://server/yetanotherpage.php?yetsomedata=1&yetsomemoredata=2))
..is any thing like this available with HTTP?
whammy
09-16-2002, 11:51 PM
Yes... coding it the way you did will do exactly what you are asking for... Request.Querystring will give you everything after the first "?" (and will not include anything before that).
Just test it out with a couple of test pages... it works rather well.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.