This is my code where I intend to handle the PHP form data on the same page.
However the PHP script doesn't get executed and instead all PHP code is rendered as comments when inspected.
<!DOCTYPE html>
<html>
<head></head>
<body>
<?php // php code ?>
//html code
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<br><br><br>
<input type="text" required name="username" placeholder="Username" class="forminput">
<br>
<span><?php echo $nameErr; ?></span>
<br>
<input type="submit" value="Sign Up" class="forminput">
</body>
</html>
How can I execute the php script in browser? All files are in root directory.