Taking input from HTML page
Stephen Lukacs (2) iquanta.org/instruct/python
"""
reference: https://iquanta.org/instruct/python ::: Example 5, Taking input from HTML page ::: Stephen Lukacs, Ph.D. ©2021-09-19
this is again server-side processing, pure python, and py4web html functions. a simple display of an input
element, the user enters their name, and the name is sent to the server, which then the server processes
and sends the output back to the client web browser...
"""
from py4web import URL, request
from yatl.helpers import FORM, CAT, INPUT, XML, A, P
if ('persons_name' not in request.forms):
rtn = FORM(_method="post")
rtn.append(CAT("Enter your name: ", INPUT(_type="text", _name="persons_name"), XML(' '), INPUT(_type="submit")))
else:
PI = request.environ.get('PATH_INFO')
rtn = CAT('in here... "', persons_name, '" ... ', A("start over", _href=URL("python/exec/"+PI[PI.rfind('/')+1:])), )