title: Unable to send data to database in Django
body: <p>I am an absolute beginner in Django development &amp; I am unable to send the data to my database via the <strong>POST</strong> method. Please guide me on what is wrong with my approach. My model worked perfectly and I can now access my desired table on my Django admin. The function that I have created in views.py always executes the else condition.</p>
  <p><strong>From views.py:</strong></p>
  <pre><code>from django.shortcuts import render, HttpResponse, redirect
  from app.models import Tbl_Feedback
  
  def myform(request):
      return render(request, 'form.html')
  def getfeedback(request):
      if request == &quot;POST&quot;:
          a = request.POST.get('a')
          objTbl_Feedback = Tbl_Feedback(a=&quot;a&quot;)
          objTbl_Feedback.save()
          return redirect(&quot;/&quot;)
      else:
          return HttpResponse('Form Not Submitted')
  </code></pre>
  <p><strong>From models.py:</strong></p>
  <pre><code>from django.db import models
  
  # Create your models here.
  
  class Tbl_Feedback(models.Model):
      fdbk = models.CharField(max_length=120)
      
  </code></pre>
  <p><strong>From urls.py(app):</strong></p>
  <pre><code>from django.contrib import admin
  from django.urls import path
  from app import views
  
  urlpatterns = [
      
      path('',views.myform,name=&quot;form&quot;),
      path('getfeedback', views.getfeedback, name=&quot;feedback&quot;)
  ]
  </code></pre>
  <p><strong>From urls.py(project):</strong></p>
  <pre><code> from django.contrib import admin
      from django.urls import path, include
      
      urlpatterns = [
          path('admin/', admin.site.urls),
          path(&quot;&quot;, include(&quot;app.urls&quot;))
      ]
  
      
  </code></pre>
  <p>Html:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
      {% load static %}
  &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;title&gt;Form&lt;/title&gt;
      {% load static %}
      &lt;link rel=&quot;stylesheet&quot; href=&quot;{%static 'css.css'%}&quot;&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action=&quot;getfeedback&quot; method=&quot;post&quot; &gt;
          {% csrf_token %}
          &lt;div class=&quot;frame&quot;&gt;
              &lt;div class=&quot;frame-header&quot;&gt;FeedBack Please !&lt;/div&gt;
              &lt;div class=&quot;frame-body&quot;&gt;
                  &lt;div class=&quot;form-element&quot;&gt;
                      &lt;div class=&quot;element-label&quot;&gt;&lt;label for=&quot;a&quot;&gt;FeedBack&lt;/label&gt;&lt;/div&gt;
                      &lt;div class=&quot;element-controller&quot;&gt;
                          
                          &lt;textarea name=&quot;a&quot; id=&quot;a&quot; cols=&quot;30&quot; rows=&quot;5&quot; class=&quot;controller-input&quot;
                          autofocus=&quot;autofocus&quot; maxlength=&quot;120&quot;&gt;&lt;/textarea&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  
              &lt;/div&gt;
              &lt;div class=&quot;frame-footer&quot;&gt;&lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt; &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;/form&gt;
  
      
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>