title: How does submit_tag know what info to submit in case of several inputs (text_field_tag, select_tag etc)?
body: <p>I was recently working on a demo web app to try to learn more about ruby on rails and I was trying to implement a search page where users could search by two attributes at the same time - search courses by course name and by subject id. I had already dealt with the associations on the backend for the database and got a working search form after trial and error for a few hours.
  However, I want to understand how and why it works, and also how specifically the submit_tag at the end knows what input to submit.</p>
  
  <pre><code>&lt;div class = "row", id = "search_filter"&gt;
      &lt;div class = "col-md-6"&gt;
          &lt;%= form_tag("/courses", method: "get") do %&gt;
              &lt;%= label_tag :search_field, "Search by course name:" %&gt;
              &lt;%= text_field_tag :search_field, params[:search_field] %&gt;            
      &lt;/div&gt;
      &lt;div class = "col-md-6"&gt;
          &lt;%= label_tag :search_dropdown, "Search by subject:" %&gt;
          &lt;%= select_tag :search_dropdown, options_from_collection_for_select(Subject.all, "id", "name", params[:search_field]) %&gt;   
      &lt;/div&gt;
      &lt;%= submit_tag 'Search', class: "btn btn-md btn-primary", name: nil %&gt;
  
      &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The layout looks a bit odd because I wanted the text_field and dropdown menu to be side by side and the search button below them. Is this a good implementation for a form or is there a better way to go about it (i.e. using a form_for). A lot of it was built by taking bits of advice from different places online, so I don't know if everything I've included is necessary. Thanks!</p>