I am trying to insert data on my database, but when i do, it says UNDEFINED INDEX

HTML code here

<form  action="insert.php" autocomplete="on"> 
        <h1> Sign up </h1> 
                                <p> 
                                    <label for="username">Your username</label>
                                    <input id="username" name="username" type="text" />
                                </p>
                                <p> 
                                    <label for="emails"  > Your email</label>
                                    <input id="emails" name="emails" type="email" /> 
                                </p>
                                <p> 
                                    <label for="password" >Your password </label>
                                    <input id="password" name="password"  type="password" />
                                </p>
                                <p> 
                                    <label for="passwordcon" >Please confirm your password </label>
                                    <input id="passwordcon" name="passwordcon"  type="password" />
                                </p>
                                <p class="signin button"> 
                                    <input type="submit" value="Sign up"/> 
                                </p>

                            </form>

PHP Code Here

<?php
$con=mysqli_connect("localhost","root","","database");

if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}


$username = mysqli_real_escape_string($con, $_POST['username']);
$emails = mysqli_real_escape_string($con, $_POST['emails']);
$password = mysqli_real_escape_string($con, $_POST['password']);
$passwordcon = mysqli_real_escape_string($con, $_POST['passwordcon']);
$sql="INSERT INTO users (usernamesignup, emailsignup, passwordsignup, passwordsignup_confirm)
VALUES ('$username', '$emails', '$password', '$passwordcon')";

if (!mysqli_query($con,$sql)) {
  die('Error: ' . mysqli_error($con));
}
echo "1 record added";

mysqli_close($con);
?>

thank you in advance..

i managed to fixed it. lol

well, I'm late ... it should be:

<form action="insert.php" method="post" autocomplete="on"> 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.