...

View Full Version : $_REQUEST issues



nickyfraggle
12-03-2008, 11:43 AM
Hello,

I am trying to get a category from a url using $_REQUEST. This all works fine until there is an & in the category title e.g main.php?cat=nicky & php

Then it only returns nicky (the half before the &). I've tried using & but it makes no difference.

I'd usually pass an id in the url (if I had to pass something) to eliminate these problems, but I'm working on someone elses software and this is how they have done it.

Is there any way you can suggest to get the whole value including the &. I'm assuming as spaces work ok it's just the & that is a problem.

Thanks,

Nicky

abduraooft
12-03-2008, 12:35 PM
Just create a form(having method="post") with one text and and a submit filed. Then type a string having an &, say a&b and then submit it. You'd see how the form handles it, by looking the url.

(Adding another input control to the form would show you, how it interprets & in the url)

mic2100
12-03-2008, 12:36 PM
try use "%26" (without the quotes) for the "&" and use "%20" for the spaces.

cat=nicky%20%26%20php

If you are unsure about wot the put u can use


echo urlencode("&");
echo urldecode("%26");

to find the values u are after

the problem you are having is because the url string uses & to separate the named values.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum