Are there any potential security risks associated with dynamically loading content into frames using PHP?

One potential security risk associated with dynamically loading content into frames using PHP is the possibility of injection attacks, such as cross-site scripting (XSS) or SQL injection. To mitigate these risks, it is important to properly sanitize and validate user input before displaying it in a frame.

<?php
// Sanitize and validate user input before loading content into frame
$content = filter_input(INPUT_GET, 'content', FILTER_SANITIZE_STRING);

// Display the sanitized content in a frame
echo "<iframe src='$content'></iframe>";
?>