This is the code i use for creating pagination links:
echo "<a href='".$_SERVER['PHP_SELF']."?".$_SERVER["QUERY_STRING"]."&page=$ni'><span>$ni</span></a>";
The only problem is that every time i click the link, the 'page'
parameter keeps multiplying in the URL:
http:..php?para1=something¶2=something¶3=something&page=2&page=3&page=4
I can undestand why. Another 'page'
parameter is added to existing URL every time i click the link.
Any ideas how to solve it?
Thanks
$_SERVER['PHP_SELF']
without at leasthtmlencode
ing it first. Otherwise, your code is very susceptible to PHP injection. Same thing with any of the$_SERVER
variables that can come from the client, really.