<?php
$txt = $_POST['username'];
echo $txt;
?>
<!DOCTYPE html>
<html>
<body>
<form method="POST" action="index.php">
<input name="username">
<input type="submit">
</form>
</body>
What I want it to do is echo the text when the form is submitted, but all it does is give me the error "Warning: Undefined array key "username" in C:\xampp\htdocs\index.php on line 2". It displays that message on the page as well, so it is very annoying.