crebs 0 Newbie Poster

I am trying to use web2py to build an app. I have a simple print function that a user submits a key word . The string or int key word is directed to an sqlite db to retrieve a row and output the data. I need to know 1. how to use the print on html. 2. How to split the far i did the list:string

Here is my code:

def first():
    form = SQLFORM.factory(Field('visitor_name',
                                 label = 'Please Type Your keyword here!',
                                 requires= [IS_NOT_EMPTY(), IS_LOWER(),'list:string']))
    form.element('input[type=submit]')['_onclick'] = "return \
    confirm('Are you sure you want to submit:');"
    if form.process().accepted:
        session.visitor_name = form.vars.visitor_name        
    return dict(form=form)

def main():    
    while True:
        name = request.vars.visitor_name or redirect(URL('first'))          
        name2 = name[:]        
        for item in name2:break
        name3 = ' '.join(name2)
        import sqlite3
        id = 0
        location = ""
        conn = sqlite3.connect("keywords.db")
        c = conn.cursor()
        c.execute('select * from kmedicals')
        records = c.fetchall()
        for record in records:
            id = record[0]
            location = record[15]
            if id == name3:
                print name3.capitalize(),':' '\n',location
        return dict(name=name)

my view...default/main.html:

{{extend 'layout.html'}}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.