def login():
if db((db.table1.username)== request.vars.visitor_name).select():
redirect(URL('index'))
else:
msg='invalid syntax'
return dict(display_msg=msg)
<form>
<input name="visitor_name" />
<input type="submit" />
{{=
</form>
{{=display_string}}
i tried it but when this display_string used in form it printed before the
enter the submit button plz send the code for this

