How do you get input from the text field in the following code?
<?php
echo "<form action='signup.php' method='POST'>";
echo "<input type='text' placeholder='Username' name='username'/>";
echo "<button type='submit' name = 'submit' value='Register' >Sign up</button>";
echo "</form>";
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
$conn = new mysqli($servername, $username, $password,"vaccinations");
$Iusername = $_POST['username'];
if(isset($_POST['submit'])){
$Iusername = $_POST['username'];
echo $Iusername;
echo "whadddup";
}
?>
This is giving me username is an undefined index. I need to grab the inputted data in the text field that was echoed