so it works to take the info from the textarea when pressing submit
and apply a function to it.
now i want to output the result of the function into the other
textarea but i get an error.
what is the right way to do web.insert?
<html>
<body bgcolor="orange">
<p>Robber's language encrypter/decrypter!</p>
<form method=post>
<p>
<select name="encdec">
<option value="encrypt">encrypt</option>
<option value="decrypt">decrypt</option>
</select>
</p>
<textarea name="enc" rows="10" cols="30">
</textarea>
<input type="submit" value="submit" /><br />
</form>
<form method=post>
<textarea name="answer" rows="10" cols="30">
</textarea>
</form>
</body>
</html>
import web
import rob
render = web.template.render('templates/')
urls = (
'/', 'main',
)
class main:
def GET(self):
print render.main()
def POST(self):
i = web.input()
if i.encdec == "encrypt":
print rob.encrypt(i.enc)
else:
print rob.decrypt(i.enc)
n = web.insert('answer', rob.encrypt(i.enc))
#signup, kolla histora tidgare roblangencryptments etc
# database stuff here to save the new user.
web.webapi.internalerror = web.debugerror
if __name__ == "__main__": web.run(urls, globals())
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---