title: How to keep form input with the same function in 2 different pages
body: <p>Guys i am new to django and want to learn how to keep the same entry field in 2 </p>
  
  <p>different pages. </p>
  
  <p>In <code>forms.py</code>:</p>
  
  <pre><code>class StudentForm(forms.ModelForm):
          name = forms.CharField(max_length=150)
  
          class Meta:
              model = Student
              fields = ['name',]
  </code></pre>
  
  <p>In <code>main.html</code> i have :</p>
  
  <pre><code>&lt;form method="POST" &gt;
                {% csrf_token %}
                {{ form}}
                &lt;button class = "btn btn-primary" type="submit"&gt;OK&lt;/button&gt; 
  
  &lt;/form&gt;
  </code></pre>
  
  <p>In <code>views.py</code>     </p>
  
  <pre><code>def studinfo(request):
      form = StudentForm(request.POST or None)
      if request.method == "POST":
          if form.is_valid():
              form1 = form.save(commit=False)
              name = form1.name
              background=Student.objects.get(stud_name=name)
  
              context={'profile':background ,}
  
              return render(request, 'main/stud_info.html', context)
  
      return render(request, 'main/main.html', context={'form':form})
  </code></pre>
  
  <p>after submitting the form it is directed to <code>stud_info.html</code> where the results are shown based on the input value from the form on <code>main.html</code>. </p>
  
  <p>My question is how i can keep the form input in <code>stud_info.html</code> page with the same function as in <code>main.html</code> so that i do not have to return to <code>main.html</code> page to look for a new value?</p>
  
  <p>So far i tried simply copying the <code>main.html</code> form into <code>stud_info.html</code> how it only displays <code>OK</code> butoon and nothing. </p>
  
  <p>I would appreciate any help and guidance in finding the solution. </p>
  
  <p>Thanks in advance. </p>