Mar-23-2017, 03:16 PM
(This post was last modified: Mar-23-2017, 03:20 PM by sparkz_alot.)
Hey guys,
I'm sorta new to web development and Python, and I have a question around passing values from the web form.
So I have a web page called Form.html, and I want to capture the values in my python script, so then I can pass those values into another method to compose a custom message.
A sample code from python looks like the following:
I'm sorta new to web development and Python, and I have a question around passing values from the web form.
So I have a web page called Form.html, and I want to capture the values in my python script, so then I can pass those values into another method to compose a custom message.
A sample code from python looks like the following:
@app.route('/form', methods=['GET', 'POST']) def form(): if request.method == "POST": txtvalue1 = request.form['txtValue1'] . . . txtvalue20 = request.form['txtValue20']So I'm able to capture the values like above no problem, but my question to you is, if I want to pass those values into another method do I have to do it as such?
custommessage(txtvalue1, txtvalue2, ..., txtvalue20)I just feel like there are so many values to pass, but is that best practice or is there a better way to do it?
Moderator sparkz_alot:
Please use code tags when posting code.