Trying to build my own webmail client. I get a template for the web part which look like this
<form name="input" action="test2.py" methog="get" class="form">
<input type="text" name="Username" placeholder="Username">
<input type="password" name="Pass" placeholder="Password">
<button type="submit" id="login-button">Login</button>
</form>
Would like to get the input on click on the button of Username && Pass via GET method to fill this bunch of code in python.
user = ???(Username)
pass = ???(Pass)
And print to a new empty html file the value of thoses var.
New to python so everything I try seem to fail.
-
docs.python.org/2/library/cgi.html#using-the-cgi-modulexrisk– xrisk2015年06月20日 17:23:22 +00:00Commented Jun 20, 2015 at 17:23
-
Excatly what I did... but seem not working on click. Do I need some Js behind ?Ragnar– Ragnar2015年06月20日 19:54:55 +00:00Commented Jun 20, 2015 at 19:54
-
I don’t think so.. could you paste your current python code here?xrisk– xrisk2015年06月21日 05:38:38 +00:00Commented Jun 21, 2015 at 5:38
2 Answers 2
You should use method="post", it won't work with a GET method (however it is misspelled, you wrote "methog").
Comments
Write import request without quotes at the top of your python file.
Now use request.inputForm['name'] without quotes to access form elements where name is the element name.