What are the drawbacks of using $PHP_SELF instead of $_SERVER['PHP_SELF'] in form action attributes in PHP scripts?

Using $PHP_SELF directly in form action attributes can pose a security risk as it can be manipulated by attackers to execute malicious code. It is recommended to use $_SERVER['PHP_SELF'] instead, as it provides a more secure way to access the PHP script filename.

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