What is the potential security risk associated with using $PHP_SELF in PHP forms?

Using $PHP_SELF in PHP forms can pose a security risk as it can make your application vulnerable to cross-site scripting (XSS) attacks. It is recommended to use htmlspecialchars() function to sanitize the value of $PHP_SELF before using it in your forms to prevent any malicious scripts from being executed.

<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">
  // Form fields go here
</form>