What is the potential issue with using $PHP_SELF in PHP forms?

Using $PHP_SELF in PHP forms can potentially expose your application to Cross-Site Scripting (XSS) attacks. This is because $PHP_SELF can be manipulated by an attacker to inject malicious code into your form. To prevent this, it is recommended to use htmlspecialchars() function to sanitize the $PHP_SELF variable before using it in your form.

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