title: Option buttons don't reload page automatically in PHP, I cannot find the error in my code
body: <p>I am working on my PHP assignment and I want to use option buttons, which reload the page automatically when I choose between them. I tried to figure out what the problem might be, but I can't find the error in the code. Below is what I've done so far, but it doesn't work for some reason.  </p>
  
  <p>This is my javascript code(album-list.js):</p>
  
  <pre><code>document.getElementById("album-sort").addEventListener("change", function (e) {
                  let current_url = window.location.href
                  window.location = updateQueryStringParameter(current_url, "sort", e.value)
              })
  </code></pre>
  
  <p>This is my own function:</p>
  
  <pre><code>function get_album_list($offset = 0, $limit = PAGE_LIMIT, $artist = null, $sorting = "title_asc")
  {
      global $db;    
      $sql = "SELECT * FROM albums";    
      if ($artist) {
          $artist = $db-&gt;real_escape_string($artist);
  
          $sql .= " WHERE artist = '$artist'";
      }    
      $order = "";
      switch ($sorting) {
          case "title_desc":
              $order = " ORDER BY title DESC";
          break;
          case "year_asc":
              $order = " ORDER BY year ASC";
          break;
          case "year_desc":
              $order = " ORDER BY year DESC";
          break;
          default:
              $order = " ORDER BY title ASC";
          break;
      }  
      $sql .= $order;
      $sql .= " LIMIT $limit OFFSET $offset";
      $result = $db-&gt;query($sql);    
      return $result;
  }
  </code></pre>
  
  <p>This is where I want to use:  </p>
  
  <pre><code>&lt;?php
      $artist = isset($_GET["artist"]) ? $_GET["artist"] : null;
      $sort = isset($GET["sort"]) ? $_GET["sort"] : "title_asc"; // Here is the mistake. $GET--&gt; $_GET
  
      $current_page = isset($_GET['page']) ? $_GET['page'] : 1;
      $limit = ($current_page - 1) * PAGE_LIMIT;
      $total_pages = get_album_count($artist) / PAGE_LIMIT;
  
      $albums = get_album_list($limit, PAGE_LIMIT, $artist, $sort);
  ?&gt;
  &lt;?php
  &lt;div class="page page-albums"&gt;
      &lt;h2&gt;Just for you&lt;/h1&gt;
      &lt;?php if ($albums-&gt;num_rows &lt;= 0) : ?&gt;
          &lt;div class="alert alert-warning"&gt;
              There is no album
          &lt;/div&gt;
      &lt;?php else : ?&gt;
          &lt;div class="album-list"&gt;
              &lt;select id="album-sort"&gt;
                  &lt;option value="title_asc"&gt;Title asc&lt;/option&gt;
                  &lt;option value="title_desc"&gt;Title desc&lt;/option&gt;
                  &lt;option value="year_asc"&gt;Release date asc&lt;/option&gt;
                  &lt;option value="year_desc"&gt;Release date desc&lt;/option&gt;
              &lt;/select&gt;
              &lt;?php while ($album = $albums-&gt;fetch_assoc()) : ?&gt;
                  &lt;?php include('_album_list_item.php'); ?&gt;
              &lt;?php endwhile; ?&gt;
          &lt;/div&gt;
          &lt;ul class="pagination"&gt;
              &lt;?php for ($i = 1; $i &lt; $total_pages + 1; $i++) : ?&gt;
                  &lt;li&gt;
                      &lt;?php if ($i == $current_page) : ?&gt;
                          &lt;span&gt;&lt;?php echo $i; ?&gt;&lt;/span&gt;
                      &lt;?php else : ?&gt;
                          &lt;a href="&lt;?php echo url('home', ['page' =&gt; $i]); ?&gt;"&gt;&lt;?php echo $i; ?&gt;&lt;/a&gt;
                      &lt;?php endif; ?&gt;
                  &lt;/li&gt;
              &lt;?php endfor; ?&gt;
          &lt;/ul&gt;
      &lt;?php endif; ?&gt;
  &lt;/div&gt;
  &lt;script src="&lt;?php echo asset('js/album-list.js'); ?&gt;"&gt;&lt;/script&gt;
  &lt;?php include "functions.php"; ?&gt;
  </code></pre>