I am getting some sort of php error in my code but i am not sure what it is my code starts to get funny at the end when you get to the bottom php. I am trying to validate the username and password but iam getting some type of error
<?php
include 'config.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Register Page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main-wrapper">
<center>
<h2 style="color: white;">Register Page</h2>
<img class="avatar" src="spaceman2.jpg" style="height: 100px; width: 100px" />
</center>
<form class="my-form" action="register.php" method="post">
<label><b>Username<b></label>
<input name="username" type="text" class="input-values" placeholder="Your username" required/>
<label><b>Password<b></label>
<input name="password" type="password" class="input-values" placeholder="Your password" required/>
<label><b>Confirm Password<b></label>
<input name="cpassword" type="password" class="input-values" placeholder="Confirm password" required/>
<input name="signup_btn" id="signup-btn" type="submit" value="Sign Up"/>
<br/>
<a href="login.php"><input id="back-btn" type="button" value="<- Back"/></a>
</form>
<?php
if(isset($_POST['signup_btn']))
{
//echo '<script type="text/javascript"> alert("You are now signed in!")</script>';
$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['password'];
if($password == $cpassword)
{
$query= "SELECT * FROM user WHERE username ='$username'";
$query_run = mysqli_query($con,$query);
if(mysqli_num_rows($query_run)>0)
{
echo '<script type="text/javascript"> alert("Astronaut name already exist") </script>';
}
{
$query= "insert into user values('$username','$password')";
$query_run = mysqli_query($con, $query);
if($query_run)
{
echo '<script type="text/javascript"> alert("Astronaut is now registered! Go to Login Page!") </script>';
}
else
{
echo '<script type="text/javascript"> alert("Error!") </script>';
}
}
?>