I'm having a few problems getting this to work. Basically I want to pass a string of variables to a script, which then passess the string of variables on again as variables - if your confused here's an example:
this gets passed to script1:
so when this is passed to script1
I want B="variable1?nextpassvariable=2&next2passvariable=3"
Which is then passed on again via a URL to the next script, and not to be broken down prior to this as follows:
I believe the solution lies in URL encoding, but am unsure on how this works.
I dont know if this is what you're looking for, but give it a try, this doesn't use a query string.
$url_array = explode("/",$PATH_INFO);
And when using that your url would look like this:
Search engines will indexed that page even though its dynamic.
where do you get $PATH_INFO from - I do not believe there is any such pre-defined variable? I tried to echo it an got nothing.
Anyway, I have an idea for a solution, if I can get hold of the 'full page URL' as a variable.
Is there an easy way to do this? - a way that would include the exact URL as written in the html of the page being linked from - including all variables, encoded charactors etc
I tried $PHP_SELF (Which is probably what you need instead of $PATH_INFO by the way) and this only holds the file name relative to the root and does not include any passed variables.
path info is a variable, why it doesn't work for you I dont know, but I copied that directly from my site and it works as intended.
Also, remember that if you are calling it from within a function you won't get anything as the variable will be outside the 'scope' of the function. If you want to access it from a function you will need to use the gloabl command at the beginning of the function i.e:
$PATH_INFO is indeed a variable, although I can't seem to get it to print on my screen right now, the only time I ever needed it is when running in CGI mode, you would use it instead of $PHP_SELF becuase $PHP_SELF points to the php interpreter(php.exe) on Windows and you want the script path, $PATH_INFO gives it to you. Maybe its gone in PHP4.0.4 aspen what version and what platform you running? There is one variable called $QUERY_STRING the holds the value of everything after the ? in a url so
if you printed $QUERY_STRING after this page loaded you would get
Also Chilliboy notice how you have tow ? marks in your query string you can only have 1 and the rest should be &
I guess from what you say that $PATH_INFO must be php3 and not php4. Not found within the pre-defined variables in the manual:
Freddie the 2 ? in the query string are intentional (See top post) - I want everything after the initial, as the second ? should be treated as litteral and only refers to a variable when it is passed on via the second script. This works fine with say
when passed to the script variable b="site.com?t=anothervariable" and is not broken down (as intentioned).
You possibly think why the hell am I passing variables like this - but believe me I do have reasons - and only very complicated alternatives!
But the problem is with & charactors after the second ? which get treated as seperate vars - hence the problem.
However, I think I have solved it and am just waiting to test: