Thursday, April 19, 2012

Passing & in query string

I want to pass '&' operator in query string. I tried to use urlencode and urldecode
but its not working. I am doing this:



$abc="A & B";
$abc2=urlencode($abc);


Then I am passing the value like this



<a href="hello.php?say=<?php echo $abc2 ?>"><?php echo $abc;?></a>


and getting value on next page as



$abc=$_GET['say'];
$abcd=urldecode($abc');
echo $abcd;


but the output is not A & B



What am I doing wrong?





No comments:

Post a Comment