when i create my form entirely in HTML, how to access the form data in views.py? I want to create a form entirely in HTML without using django form class. When i have done, how to access the form field data in the views.py?. I want to use the data at backend. Please help me
<html>
<head>
<title>
HTML forms
</title>
</head>
<body>
<p> This is a simple form</p>
<form action="" method="post">
{% csrf_token %}
<fieldset>
<legend> Personal Information</legend>
<label for="name">contact_name:<br></label>
<input type="text" name="contat_name" id="name"><br>
<label for="email">contact_email:<br></label>
<input type="email" name="email" id="email" required placeholder="[email protected]"><br>
<label for="content">content:<br></label>
<textarea name="content" rows="10" cols="30">
</textarea>
<br>
<input type="submit" value="submit">
</fieldset>
</body>
</html>
this is my HTML form i want to access the contact_name and contact_email in views.py. how to access the data?
def htmlform(request):
if request.method=="POST":
print request.POST.get("contact_name")
return render(request,"htmlform.html")
when i used request.POST.get("contact_name") it returns nothing.