title: Django : After selecting element from dropdown list, how to perform an action
body: <p>I want to select the option from dropdown list and according to selected element go to my database file which is CSV show the result related to that selected element.</p>
  
  <pre><code>my HTML code:
   {% extends "base.html"%}
  {%block body%}
  {% load static %}
  &lt;section&gt;
      &lt;h2 align ="center" margin = 10px&gt;  Selecting parameters &lt;/h2&gt;
          &lt;div&gt;
              &lt;form align = 'center' method ="post" action=" help to describe this action url where to direct ?"  &gt;
                  {%csrf_token%}
  
               &lt;label class="label"&gt;Generators&lt;/label&gt;
               &lt;select id = "myList" onchange="this.form.submit()"&gt;
                  {% for name in generator %}
                 &lt;option&gt; {{name}}&lt;/option&gt;
                 {%empty%}
                 &lt;option&gt; no list found &lt;/option&gt;
                 {%endfor%}
  
  
               &lt;/select&gt;
  
          &lt;/div&gt;
      &lt;div&gt;
      &lt;button type="submit" class="myButton"&gt; submit &lt;/button&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  
    &lt;textarea&gt;{{selected_generator}}&lt;/textarea&gt;
  
  
  &lt;/section&gt;
  
  
  &lt;footer id="main-footer"&gt; &lt;p&gt; Copyright &amp;2019; polito interdispilinary group 2019&lt;/p&gt;
  
  &lt;/footer&gt;
  
  {%endblock%}
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  Views.py 
  
  def generator(request):
  
      file = pd.read_csv("G:/interdispilinary project/Website/resources/generator/up_op_zone.csv")
      df = pd.DataFrame(file)
      generator= df['generator']
      operator = df['operator']
      zone = df['zone']
      return render(request, 'generator.html',{'generator':generator})
  
  
  def gen_results(request):
      if request.method =='POST':
          user_submit = gen_form(request.POST)
          print(request.POST)
          if user_submit.is_valid():
              print(user_submit)
              selected_generator = user_submit.cleaned_data['generator']
              request.session['selected_generator'] = selected_generator
          df = pd.read_csv("G:/interdispilinary project/Website/resources/generator/up_op_zone.csv",names=["generator","operator","zone"])
          df1 = df[df["generator"]==selected_generator][["operator","zone"]]
          return render(request, 'generator.html',{'selected_generator':selected_generator})
  
  
  url.py
  
  urlpatterns = [
      url(r'^$', views.homepage, name='homepage'),
      url(r'^generator', views.get, name='generator_url'),
      url(r'^gen_results', views.gen_results, name='gen_results_url'),
  
      url(r'^market', views.market, name='market_url'),
      url(r'^operator', views.operator, name='operator_url'),
  </code></pre>
  
  <p>when i will click to submit button it have to save the result into session and then according to gen_result function it should render the page again</p>