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.
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.
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
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.
Thanks everybody for technical support. Using base64_encode i able to solve it.
You missed the right answer.
pnw, there is no single problem with forms. Both GET and POST works fine.
That's a relief. I have removed that previous post as I as completely wrong.