Dear all,

I have a string array “$query_string1” having the value (reg_personal.personal_sex=’Male’)
I want to pass this value through the URL for the use of pagination..
For that I used the command “<a href='{$_SERVER}?pageno=1&query_string=$query_string1'>First</a>

When I am clicking on the Link First the passed query string contains only
“Reg_personal.personal_sex=” It is missing the ‘Male’ Part……..

Is there any way to pass that ‘Male’ part also through the url…

Please help me..
Thanks in advance,

10 Years
Discussion Span
Last Post by miguelp

For what i can see the problem is that PHP dosent interpret the code inside single quotes(') it treats all like a string. so i recomend you change your code to this

	$query_string1 = "reg_personal.personal_sex='Male'";
	echo "<a href=\"".$_SERVER['PHP_SELF'] ."?pageno=1&query_string=" . $query_string1 . "\">First</a>";

The url generated by that code is:

In order to avoid future problems with getting values from the url i strongly advise you to use the functions urlencode() and urldecode(), these 2 functions will format a string in order to be passed in a url and back to variables again.

As URL parameters work like couples this:
may cause problems because of the two attribution signs (=) so if you use urlendode you will have something like this:

	$query_string1 = urlencode("reg_personal.personal_sex='Male'");
	echo "<a href=\"".$_SERVER['PHP_SELF'] ."?pageno=1&query_string=" . $query_string1 . "\">First</a>";

that will outup a URL safe address that you can catch and manipulate data without problems, like this one:


urldecode() will convert this data reg_personal.personal_sex%3D%27Male%27 to the original format, something like this:

hope it helps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.