Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Python CGI打印新页面_Python_Html_Cgi - Fatal编程技术网

使用Python CGI打印新页面

使用Python CGI打印新页面,python,html,cgi,Python,Html,Cgi,我正在使用/学习Python来完成CGI任务。基本上,我们必须呈现一些表单,然后根据用户输入,呈现不同的表单,等等 这是到目前为止我的脚本代码: import cgi import cgitb cgitb.enable() # for troubleshooting print ("Content-type: text/html\n\n") form1 = open("html/assg5form1.html") form2 = open("html/assg5form2.html") for

我正在使用/学习Python来完成CGI任务。基本上,我们必须呈现一些表单,然后根据用户输入,呈现不同的表单,等等

这是到目前为止我的脚本代码:

import cgi
import cgitb
cgitb.enable()  # for troubleshooting
print ("Content-type: text/html\n\n")
form1 = open("html/assg5form1.html")
form2 = open("html/assg5form2.html")
form3 = open("html/assg5form3.html")
form4 = open("html/assg5form4.html")
form5 = open("html/assg5form5.html")
formstring = form1.read()
print formstring

我遇到的问题是,在展示了第一个表单之后,我不知道如何处理用户提供的输入。我通常会将一个操作附加到表单并启动另一个脚本,但我们需要在一个文件中完成所有脚本。如何清除我显示的表单并显示另一个表单?

在处理页面布局时,html文件头部的Javascript可能会有所帮助:)