Browser won’t show my input value in address bar, and won’t log values in console

Basically when I type simple form like this

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="loginContainer">
      <form>
        <div>
          <label for="name">Name:</label>
          <input id="name" type="text" />
        </div>

        <div>
          <label for="password">Password:</label>
          <input id="password" type="password" />
        </div>

        <input type="submit" value="Login" />
      </form>
    </div>

    <script>
      let nameVal = document.getElementById("name").value;
      let passwordVal = document.getElementById("password").value;

      console.log(nameVal);
      console.log(passwordVal);
    </script>
  </body>
</html>

My browser just shows in the address bar file:///C:/Users/User1/Desktop/index.html?, and also it won’t log my name and password in console, it just looks like the page refreshes when I click the submit buttton and that’s it, I remember before when I did stuff with forms, it would usually write in the address bar something like “…index.html?name=somerandomdata”, did I write the form right? It seems like it doesn’t process input values at all..I’m confused

I tried on firefox this same code, same result