Have you defined the blog1 table anywhere? If you have, the code looks OK -- what are you observing, and what do you expect instead?
Anthony On Monday, November 20, 2017 at 4:46:07 PM UTC-5, Sandeep Patel wrote: > > I want to take data from the user using my HTML template and insert that > data into my database without using SQLFROM and FROM in my controller file. > can I do it? > Actually, I am new in web2py, please give me direction. > > Here file > #model file > from gluon import DAL, Field > mysql = DAL('mysql://********:********@*******. > cgaqtjjdhgni.ap-south-1.rds.amazonaws.com/saflta') > > > #controller file > def request_vars(): > if request.post_vars: > mysql.blog1.insert(blog_title= request.post_vars.title) > response.flash = T("Done") > return locals() > > > #view file > > {{extend 'layout.html'}} > <h1>This is the basics/request_vars.html template</h1> > <form method='post'> > <input type='text' name='title' /> > <input type='submit' value='submit' /> > </form> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.