What is the potential issue with using $_PHP_SELF in a form action attribute in PHP?

Using $_PHP_SELF in a form action attribute in PHP can pose a security risk as it makes the form vulnerable to cross-site scripting attacks. To solve this issue, it is recommended to use htmlspecialchars() function to escape special characters in the $_PHP_SELF variable before using it in the form action attribute.

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