title: Javascript advanced search with multiple fields
body: <p>I'm trying to set up a search function in my fictional movie rental website where the user can fill a form that takes inputs on the film title, actor, director, genre and country. the way the search function is set up now is that the user can only search one thing at a time. for example only find movies from a certiain genre and no more specifications is allowed. I want to set it up so that the user can fill as many of the search fields as they want to get a more specific search but I cant come up with a solution. any tips and help would be appreciated. here is one of the search functions to give you an idea, all of them are about the same:</p>
  
  <pre><code>function search_for_title(search) {
  
      var results = [];
  
      for (index in search_results) {
  
          title = search_results[index].otitle;
          movies_object[index].genres = genres_object[index]; //henter sjanger info fra genres_object databasen
  
          lowTitle = title.toLowerCase();
          lowSearch = search.toLowerCase();
  
          if (lowTitle.includes(lowSearch)) {
              results.push(movies_object[index]);
          }
      }
      displayResults(results);
  }
  </code></pre>
  
  <p>This is how the functions run, I'm sure this is the part of the code that needs to be modified:</p>
  
  <pre><code>window.onload = function() {
      query_params = get_query_string_parameters();
      search_results = movies_object;
  
      if (query_params.film_title) {
          search_for_title(query_params.film_title);
      }
  
      if (query_params.actor) {
          search_for_actor(query_params.actor);
      }
  
      if (query_params.director) {
          search_for_director(query_params.director)
      }
  
      if (query_params.genre) {
          search_for_genre(query_params.genre)
      }
  
      if (query_params.country) {
          search_for_country(query_params.country)
      }
  } 
  </code></pre>