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..