I want to send multiple values to a different page using a href
link. But what I retrieve is the first 2 values only, rest shows an error of undefined index.
You must HTML-escape those ampersands properly:
?coice=search&cat=...&subcat=...&srch=...
&sub
(of &subcat
) gets interpreted as ⊂
which is a special HTML entity for the subset operator:
⊂ or ⊂ = subset of ⊂
Also make sure you properly escape your variables to prevent XSS.
try using urlencode, as if there are any special characters in the strings, it could have an effect on the querystring as a whole;
echo "<a href='index.php?choice=search&cat=".urlencode($cat)."&subcat=".urlencode($subcat)."&srch=".urlencode($srch)."&page=".urlencode($next)."'> Next </a>";
Plus you had a space between srch and page, that could have been causing a problem.