Undefined array key for every field [duplicate]

just to clarify I’m someone with absolutely no knowledge of PHP prior to this project.

i found this problem on my code and i cant solve i am trying to follow some youtube video and it same that the code is exactly like but still i cant fix it

this the error:

Warning: Undefined array key "first_name" in   
C:xampphtdocsSocial mediaClasssignup_class.php on line 36  
Warning: Undefined array key "first_name" in  
C:xampphtdocsSocial mediaClasssignup_class.php on line 39  
Warning: Undefined array key "last_name" in  
C:xampphtdocsSocial mediaClasssignup_class.php on line 40  
Warning: Undefined array key "gender" in  
C:xampphtdocsSocial mediaClasssignup_class.php on line 41  
Warning: Undefined array key "email" in  
C:xampphtdocsSocial mediaClasssignup_class.php on line 42  
Warning: Undefined array key "password" in 
C:xampphtdocsSocial mediaClasssignup_class.php on line 43  
Fatal error: Uncaught Error: Call to undefined function create_userid() in 
C:xampphtdocsSocialmediaClasssignup_class.php:47  
Stack trace:    
#0 C:xampphtdocsSocial mediaClasssignup_class.php(26):  
Signup->create_user(Array)  
#1 C:xampphtdocsSocial mediasign_up.php(12):  
Signup->evaluate(Array)  
#2 {main} thrown in 
C:xampphtdocsSocial mediaClasssignup_class.php on line 47

my code for that particular error:

this is for the signup page

<form method= "post" action="">
  <input name="first_name" 
    type="text" style="width:300px;height:30px;border-radius:5px;margin-top:40px;margin-left:250px;padding-left:10px" 
    placeholder="First Name">
  <br>
  <input name="last_name" 
    type="text" 
    style="width:300px;height:30px;border-radius:5px;margin-top:20px;margin-left:250px;padding-left:10px;" 
    placeholder="Last Name">
  <br>
  <P style="text-align:center;">
    Gender:
  </P>
  <select name="gender" 
    style="width:300px;height:30px;border-radius:5px;margin-top:5px;margin-left:250px;padding-left:10px;"
    >
    <option value="Male">Male</option>
    <option value="Female">Female</option>
  </select>
  <br>
  <input name="email" 
    type="text" 
    style="width:300px;height:30px;border-radius:5px;margin-top:10px;margin-left:250px;padding-left:10px;" 
    placeholder="Email">
  <br>
  <input name="password" 
    type="password" 
    style="width:300px;height:30px;border-radius:5px;margin-top:20px;margin-left:250px;padding-left:10px;" 
    placeholder="enter Your Password">
  <br>
  <input name="pass2" 
    type="password" 
    style="width:300px;height:30px;border-radius:5px;margin-top:20px;margin-left:250px;padding-left:10px;" 
    placeholder=" Reetyoe Password">
  <br>
  <input 
    type="submit" 
    style="width:300px;height:30px;border-radius:5px;margin-top:20px;margin-left:250px;background-color:#4b5c77;color:white;cursor:pointer;border:none;" 
    value="Sign up">
  <br>
</form>

and this is the class where the error is coming from

public  function create_user($data)
  { // calling the database class to save the data
  $firstname = $data["first_name"];
  $lastname  = $data['last_name'];
  $gender    = $data['gender'];
  $email     = $data['email'];
  $password  = $data['password'];

  // creating a url_adress for the user and the userid
  $url_adress = strtolower($firstname) . strtolower( $lastname);
  $userid     = create_userid();

  $query = "insert into users
         (userid,first_name,last_name,gender,email,password,url_adress)
         values
         ('$userid', '$first_name','$last_name','$gender','$email','$password','$url_adress')";

  include_once("connect.php");
  return $query;
  /*
  $db = new Database();
  $db->save($query);
  */
  }
private function create_userid()
  {
  // creating a random number for the user id
  $length = rand(4,19);
  $number = "";
  for($i=0; $i<$length; $i++)
    {
    $rand_number = rand(0,9);
    $number .= $rand_number;
    return $number;
    }
  }