santanu — 2010-01-15T01:54:06-05:00 — #1
My url is http://localhost/plan-detail.php?planname=CoreGuard EPO 10000 2+ Members&st=CA
I caprtue get data in php.
echo $planName =$_GET['planname'];
OUTPUT >> CoreGuard EPO 10000 2 Members
- one space is missing between EPO 10000
- '+' is missing
Output and original value of variable $planname is different. I want to how to solve this problem and why it's happen.
dan_grossman — 2010-01-15T02:01:30-05:00 — #2
You're not URLencoding the planname value in whatever code creates that URL. It can't include a plus because a plus means a space in a URL. The spaces should be %26.
raju_gautam — 2010-01-15T02:19:07-05:00 — #3
If there are such and more complicated special characters that need to be passed through URL then I would normally encode data with MIME base64 and decode it back in the target page.
$url = 'http://localhost/plan-detail.php?planname=' . base64_encode('CoreGuard EPO 10000 2+ Members') . '&st=CA';
And in plan-detail.php page
paul_wilkins — 2010-01-15T02:27:16-05:00 — #4
This is a natural issue with the GET method, as spaces are represented in the url as the plus sign.
If you wish to preserve the spaces and the plus sign for what they are, try use the POST method instead.
santanu — 2010-01-15T04:05:06-05:00 — #5
Thanks everybody for technical support. Using base64_encode i able to solve it.
system — 2010-01-15T04:32:16-05:00 — #6
You missed the right answer.
system — 2010-01-15T04:43:28-05:00 — #7
pnw, there is no single problem with forms. Both GET and POST works fine.
paul_wilkins — 2010-01-15T04:52:26-05:00 — #8
That's a relief. I have removed that previous post as I as completely wrong.