0

I have a form in which I can input text through text boxes.
How do I make these data go into the db on clicking submit.

this is the code of the form in the template. What do I give in form action?

<form method="post" action="[B]what do I put here??[/B]">
<p>
Title:<input type="text" name="title"/>
</p>
<p>
Name:<input type="text" name="name"/>
</p>
<p>
Phone:<input type="text" name="phone"/>
</p>
<p>
Email:<input type="text" name="email"/>
</p>
<p>
<textarea name="description" rows=20 cols=60>
</textarea><br>
</p>
<input type="submit" value="Submit"/>
</form>

I have a function in the views.py for saving the data in the page. But I dont know how to impliment it properly:

def save_page(request):
   title = request.POST["title"]
   name = request.POST["name"]
   phone = request.POST["phone"]
   email = request.POST["email"]
   description = request.POST["description"]

Now how do I send these into the db?

I went through forms in django docs but couldnt understand anything.

Thank you.

2
Contributors
1
Reply
4
Views
7 Years
Discussion Span
Last Post by Kruptein
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.