I'm new to PHP and I got this error while trying to create a signup page.
Notice: Undefined index: signup in C:\xampp\htdocs\index\PHP\loginsystem\signup.php on line 34
This is the code of the sign..php
<?php
require 'header.php';
?>
<main>
<div class="container">
<h1>Sign up</h1>
<?php
if(isset($_GET['error'])){
    if($_GET['error'] == "emptyfields"){
        echo "<p style='color:coral;'>fill in all fields!</p>";
    }
   else if($_GET['error'] == "invaliedemail&username"){
        echo "<p style='color:coral;'>invalied email and username</p>";
    }
    else if($_GET['error'] == "invaliedemail"){
        echo "<p style='color:coral;'>invalied email</p>";
    }
    else if($_GET['error'] == "invaliedid"){
        echo "<p style='color:coral;'>invalied username</p>";
    }
    else if($_GET['error'] == "passwordcheck"){
        echo "<p style='color:coral;'>invalied password</p>";
    }
}
        else if($_GET['signup'] == "success"){                      //error HERE  
            echo "<p style='color:green;'>sign successful</p>";
    
        }
?>
<form action="signup.inc.php" method="POST" class="form-inline my-2 my-lg-0">
<input class="form-control mx-sm-2" type="text" name = "username" placeholder="User Name">
<input class="form-control mx-sm-2" type="text" name = "email" placeholder="Email">
      <input class="form-control mx-sm-2" type="password" name = "pass" placeholder="Password">
      <input class="form-control mx-sm-2" type="password" name = "pass-repeat" placeholder="repeat-Password">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name = "signup-submit">Sign up</button>
</form>
</div>
</main>
<?php
require 'footer.php';
?>
And this is the code signup.inc.php
<?php
if(isset($_POST['signup-submit'])){
  require 'db.inc.php';
  $username = mysqli_real_escape_string($conn,$_POST['username']);
  $email = mysqli_real_escape_string($conn, $_POST['email']);
  $pass = mysqli_real_escape_string($conn, $_POST['pass']);
  $pass_repeat = $_POST['pass-repeat'];
 if( empty($username) || empty($email) || empty($pass) || empty($pass_repeat) ){
    header("location:signup.php?error=emptyfields&username=".$username."&email=".$email);
      exit();
 }
 else if (!filter_var($email,FILTER_VALIDATE_EMAIL) && !preg_match('/^[a-zA-Z\s]+$/',$username)  ){
    header("location:signup.php?error=invaliedemail&username");
    exit();
 }
 else if (!filter_var($email,FILTER_VALIDATE_EMAIL)){
    header("location:signup.php?error=invaliedemail&username=".$username);
    exit();
 }
 else if (!preg_match('/^[a-zA-Z\s]+$/',$username)){
    header("location:signup.php?error=invaliedid&mail=".$email);
    exit();
 }
 else if ($pass !== $pass_repeat){
    header("location:signup.php?error=passwordcheck&username=".$username."&email=".$email);
    exit();
 }
 else{
     $sql = "SELECT username FROM users WHERE username =?";
     $stmt = mysqli_stmt_init($conn);
     if(!mysqli_stmt_prepare($stmt,$sql)){
        header("location: signup.php?error=sqlerror");
        exit(); 
     } else {
         mysqli_stmt_bind_param($stmt,"s",$username);
         mysqli_stmt_execute($stmt);
         mysqli_stmt_store_result($stmt);
         $resultcheck = mysqli_stmt_num_rows($stmt);
         if ($resultcheck >0){
            header("location:signup.php?error=usertaken");
            exit(); 
         } else {
             $sql = "INSERT INTO users (username,email,pass) VALUES (?,?,?)";
             $stmt = mysqli_stmt_init($conn);
             if(!mysqli_stmt_prepare($stmt,$sql)){
                header("location: signup.php?error=sqlerror");
                exit(); 
             }
             else{
                 $hashpass = password_hash($pass,PASSWORD_DEFAULT);
                mysqli_stmt_bind_param($stmt,"sss",$username,$email,$hashpass);
                mysqli_stmt_execute($stmt);
                header("location: signup.php?signup=success");
                exit(); 
             }
         }
     }
 }
 mysqli_stmt_close($stmt);
 mysqli_close($conn);
 
 
}
     else{
    
        header("location: signup.php");
        exit();
     }
Everything is running perfectly but the error message pops out in the signup page interface. How do I remove it or is it something wrong with my code?
 
     
     
    