如何在重定向的php页面中使用下拉数据作为参考?

I have lots of PHP pages, and i have a seesion started already, i also have a php page that contains a dropdown menu from the database.

Now i want to use the data selected in the dropdown of my current page as a reference for populating the dropdown i have in the next page, but i dont kw how to do that: this is my code for the first php page :

enter  <form method = "get" action = "register.php">
  <label>Choose Department:</label><br>
   <select name = "select" class= "textfields" id= "">

       <option id = "">Choose department</option>

   <?php
   //connect to db 
  $connect = mysqli_connect('localhost', 'root', '', 'guu portal') or die ('cant you just connect to the database');                  

  $query = "select * from departments";
  $result = mysqli_query($connect,$query);

  while($row = mysqli_fetch_array($result)){  
      $take = $row['id'] ;                
 ?>       
  <option id = "<?php echo $take; ?>"><?php echo $row['departments']; ?></option>
  <?php } 
  ?>



here

now dis is working, buh i want to use the $take as reference in this other page, here is the code:

enter  <form class= "form" role = "form" method="post" action=""> 
         <fieldset><legend>Course Registration</legend> <div class = "col-sm-12"><label>code</label><select name ="select"> <option id ="">choose</option>








<?php 
$connect = mysqli_connect('localhost', 'root', '', 'guu portal') or die ('cant you just connect to the database');

$query = "select * from registration";

$result = mysqli_query($connect,$query); 

while($row = mysqli_fetch_array($result)){ 
?>
<option id = "<?php echo $row['departments'];?>"><?php echo $row['course_code']; ?></option>
<?php }
?> 
</select>

<label>title</label>
<select name= "select"> 
<option id ="">---</option>
<?php $query = "select * from registration";
$result = mysqli_query($connect,$query); 

while($row = mysqli_fetch_array($result)){ 
 ?>
<option id = "<?php echo $row['departments'];?>"><?php echo $row['title']; ?></option>          
<?php }
?>
</select>

<label>unit</label>
<select name= "select"> 
<option id ="">---</option>
<?php $query = "select * from registration";
$result = mysqli_query($connect,$query); 
while($row = mysqli_fetch_array($result)){ 
?>
<option id = "<?php echo $row['departments'];?>"><?php echo $row['unit']; ?></option>          
<?php }
?>
</select>  

here

so pls how do i do that?

If I understand you correctly, you are trying to pass $row['departments'] to the second file.

You can either use ajax call or pass it through the url.