kate_hudson kate_hudson - 6 months ago 16
PHP Question

Sanitizing url parameters

Sorry, posted an incorrect question, will update soon.

Answer

I think you're looking for htmlentities

I would set it to an intermediate variable, since you're using the $_REQUEST array later instead of $_GET

$id = urlencode(htmlentities($_GET['id']));

and then later

<a href="https://test.com/page2.php?id=<?php print $id; ?>">Link</a>
Comments