And I need to do some differing Javascript stuff depending on what URL is passed as an URI string. I got it working in my own installation of IE, Chrome & Firefox, but when I pushed it live it apparently did not work for a lot of people. I have not been able to replicate any problems but I know it didn't work for one person running Chrome on a Mac.

I'm not sure how to proceed with this. My google powers failed to yield anything beyond producing the code above. I can't find anything specific regarding brackets in URI string names, and colons, slashes in URIs.. And I've learned everything backwards so I don't know what I should read up on.

Can anyone see any reason as to why this would fail for anyone?

PS. I have no influence over the URI content.

PPS. Is it possible it fails because the brackets gets encoded for some and is therefore not removed in line 5 of the posted code?

03-13-2013, 09:05 PM

Old Pedant

Well, seeing brackets in a URL like that is common: PHP requires those if the <form> field in question can have multiple values, as is the case with checkboxes. That is, a PHP <form> might look like this:

This version has the advantage that it leaves the key value alone. I still don't see why you want to convert success_url[] to success_url. It also handles multiple occurrences of the key value, whether PHP style (with the brackets) or JSP/ASP/ASP.NET style (without brackets).

This version has the advantage that it leaves the key value alone. I still don't see why you want to convert success_url[] to success_url. It also handles multiple occurrences of the key value, whether PHP style (with the brackets) or JSP/ASP/ASP.NET style (without brackets).
Yes, it always returns an array, just in case the name is multiply-defined. But if you convert the one-element array to a string, then you get just the one value.

Thank you so much for the code suggestions you have written, I will try these with some visitors and see if they remedy my problem. If it does not I must be missing something elsewhere.