The problem of moving a variable to another page [duplicate]

Hi I’m using this code in my page to move to the same page but with account access, I’m learning how to use various languages so I didn’t want to use Javascript.

<label for="toggleBanner" class="open-btn">Log In</label>

      <!-- Overlay del banner -->
      <div class="overlay">
        <div class="overlay-content">
          <!-- Etichetta per chiudere il banner -->
          <label for="toggleBanner" class="close">&times;</label>
          <h2>Inserisci credenziali</h2>
          <form method="post" action="LogIn.php?CODICE=<?php echo htmlspecialchars($codice, ENT_QUOTES, 'UTF-8'); ?>">
            <label for="name">Nome:</label>
            <input type="text" id="name" name="name" required><br><br>
            
            <label for="password">Password:</label>
            <input type="password" id="password" name="password" required><br><br>
            
            <input type="submit" value="Invia">
          </form>
        </div>
      </div>

The problem that occurs is that the $codice that passes from one page to another is not received and is always interpreted 0.
Thanks in advance for any advice, and also for tips on other things

Despite having checked several times that before pressing send the page knows which code it refers to.