samedi 5 juillet 2014

how can I put data which I select from db, put in Textbox of form?


Vote count:

0




This is my .py code:


import web


import MySQLdb


urls = ('/', 'query')


tmpl = web.template.render('templates/')


class query:



form = web.form.Form(
web.form.Textbox('title', web.form.notnull,
description="I need to:"),

)

def GET(self):

""" Show page """
res = db.select('student',where="name='mina'")

self.form.Textbox=res

return tmpl.index( self.form)


app = web.application(urls,globals())


db = web.database(dbn='mysql', db='std', user='root', pw='123456')


if name == "main":



app.run()


and this is .html file.


I want to see data of 'Bob' in textbox of form.



asked 20 secs ago






Aucun commentaire:

Enregistrer un commentaire