python - Can not get params from URL - why is my cgi.FieldStorage() empty? -
i cant parameters url. after reading numerous posts on web nothing seems answer question...
i have simple html file:
<html> <head> </head> <body> <form action="test.py" method="get"> name: <input id="person_name" type="text" name="person_name" > <input id="submit_button" type="submit" value="submit" > </form> </body>
and python script looks this:
import cgi, cgitb form = cgi.fieldstorage() name = str( form.getvalue('person_name') ) print ("content-type:text/html\n\n") print ("<html>") print ("<head>") print ("</head>") print ("<body>") print ("hello " + name ) print("<br/>") print ("all params: " + str(form) ) print ("</body>") print ("</html>")
however, when execute html file , type "mike" name, python script prints:
hello none params: fieldstorage(none, none, [])
the cgi.fieldstorage() empty. how can fix it?
it's hard say.
<form action="test.py" method="get">
error?
it should <form action="cgi-bin/test.py" method="get">
if "cgi-bin" not part of url sgi scripts not executed. it's surprising kind of response.
Comments
Post a Comment