Help with url string

Hi guys,

How can I convert this variable contained in the url using get:


n= Stacking & Nesting Boxes

You mean you want the string to be same in the URL? Did you try urlencode().


echo '<a href="date.php?id=126&n=' . urlencode('Stacking & Nesting Boxes') . '">Test</a>';

To convert it back to the original, you want to use urldecode(). However, be careful outputting that into the page because it can open your website to XSS attacks.