Here is the code, it is telling me I have an undefined index which is weird because I already defined it with HTML code. Any way around this error? or any ways to make it better would be much appreciated...
<h1>make a username</h1>
<form method="post" action="<?php echo
htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
Username: <input type="text" name="username" value="<?php echo $username; ?>">
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
<?php
$username = $_POST["username"];
echo $username;
?>