为什么 select 选项没有显示在 PHP 上

Why select option is not showing on PHP

            <select class="gps_sel" name="gps_sel" id="gps_sel" style="color: #000;">
                  <option value="0">GPS Tracking</option>
                  <?php
                    require'connectDB.php';
                        $sql = "SELECT RTMGPS.gps_id
                        From RTMGPS
                        WHERE NOT EXISTS (SELECT employee_users.gps_id FROM employee_users WHERE RTMGPS.gps_id = employee_users.gps_id)";
                       
                        $result= mysqli_query($conn,$sql);
                           $Arr= array();
                           while ($dataStat = mysqli_fetch_assoc($result))
                    {
                         $Arr[] = $dataStat; 
                         
                    }
                    
                        ?>
                          <option value="<?php json_encode($Arr) ?>"><?php echo $row['RTNumber']; ?></option>
                  <?php
        
                  ?>
                </select>

这是我的 select 选项下拉代码,但它没有显示我想要显示的数据

我认为这是正确的代码。你需要把选项放在 while 循环中。但实际上我不知道你为什么使用 json encode in value of that from,什么是 $row[''].

                <select class="gps_sel" name="gps_sel" id="gps_sel" style="color: #000;">
                  <option value="0">GPS Tracking</option>
                  <?php
                    require'connectDB.php';
                        $sql = "SELECT RTMGPS.gps_id
                        From RTMGPS
                        WHERE NOT EXISTS (SELECT employee_users.gps_id FROM employee_users WHERE RTMGPS.gps_id = employee_users.gps_id)";
                       
                        $result= mysqli_query($conn,$sql);
                           $Arr= array();
                           while ($dataStat = mysqli_fetch_assoc($result))
                    {
                         $Arr[]=json_decode($dataStat);

                          echo "<option value='".json_encode($Arr)."'>".$row['RTNumber']."</option>";

}
 ?>
                </select>