简单的,可以使用python 的CGI模块,需要你的服务器开启CGI支持。
网页内容如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>python cgi</title>
</head><body>
<p style="font-size:24pt;color:red">输入登录密码:</p>
<form name="zhaji" action="login.py" method="post">
<p>密 码:<input type="password" name="ma" size="9"></p>
<input type="button" name="shuru" value="登录" onclick="zhaji.submit()">
</form>
</body></html>
login.py文件内容如下:
#!/usr/bin/python
#coding:utf-8
import cgi
form = cgi.FieldStorage()
ma = ""
if 'ma' in form:
ma = form["ma"].value
print '''Content-Type: text/html\n\n'''
print '''<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>python cgi</title></head><body><p>你输入的密码是:%s</p> </body></html>''' % ma