PHP Notice: Undefined index: Name in D:\xampp\htdocs\register\connection.php on line 8 PHP Notice: Undefined index: Username in D:\xampp\htdocs\register\connection.php on line 9 PHP Notice: Undefined index: Password in D:\xampp\htdocs\register\connection.php on line 10 PHP Notice: Undefined index: ConfirmPassword in D:\xampp\htdocs\register\connection.php on line 11 PHP Notice: Undefined index: Birthday in D:\xampp\htdocs\register\connection.php on line 12 PHP Notice: Undefined index: Gender in D:\xampp\htdocs\register\connection.php on line 13 PHP Notice: Undefined index: MobilePhone in D:\xampp\htdocs\register\connection.php on line 14 PHP Notice: Undefined index: CurrentEmailAddress in D:\xampp\htdocs\register\connection.php on line 15 PHP Notice: Undefined index: Location in D:\xampp\htdocs\register\connection.php on line 16 PHP Notice: Undefined variable: con in D:\xampp\htdocs\register\connection.php on line 32 PHP Notice: Undefined variable: query in D:\xampp\htdocs\register\connection.php on line 32 PHP Warning: mysqli_query() expects parameter 1 to be mysqli, null given in D:\xampp\htdocs\register\connection.php on line 32 PHP Notice: Undefined variable: con in D:\xampp\htdocs\register\connection.php on line 39 PHP Warning: mysqli_close() expects parameter 1 to be mysqli, null given in D:\xampp\htdocs\register\connection.php on line 39

if(isset($_POST['submit']))
{
$Name=$_POST["Name"] ;
$Username=$_POST["Username"] ;
$Password=$_POST["Password"] ;
$ConfirmPassword=$_POST["ConfirmPassword"] ;
$Birthday=$_POST["Birthday"] ;
$Gender=$_POST["Gender"] ;
$MobilePhone=$_POST["MobilePhone"] ;
$CurrentEmail=$_POST["CurrentEmailAddress"] ;
$Location=$_POST["Location"] ;

if(!empty($Username))
{
$host="localhost";
$user="root";
$pass="";
$database="mydb";



$con= mysqli_connect($host, $user, $pass , $database);


$query="INSERT into mytable1(Name , Username , Password , ConfirmPassword , Birthday , Gender , MobilePhone , CurrentEmailAddress , Location)VALUES('$Name' , '$Username' , '$Password' , '$ConfirmPassword' , '$Birthday' , '$Gender' , '$MobilePhone' , '$CurrentEmailAddress' , '$Location')";
}
if(mysqli_query($con , $query))
{
echo "database data inserted" ;
}
else{
echo"data failed";
}
mysqli_close($con);
}