kate_hudson kate_hudson - 1 year ago 113
PHP Question

Sanitizing url parameters

Sorry, posted an incorrect question, will update soon.

Answer Source

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>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download