What is the potential issue with using $_SERVER['PHP_SELF'] in a form action attribute in PHP code?

Using $_SERVER['PHP_SELF'] in a form action attribute can make your code vulnerable to cross-site scripting (XSS) attacks. It exposes your application to potential security risks by allowing an attacker to inject malicious code into your form action URL. To solve this issue, you should sanitize the input by using htmlspecialchars() function to prevent any malicious code from being executed.

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