网页使用CGI Python重定向到主页面 [英] Webpage redirect to the main page with CGI Python
问题描述
我希望当用户按下提交时,答案会自动转到处理脚本,页面会自动刷新新问题或者至少在处理后重定向到主调查页面,并带有一个新问题。
你想要实现这个: https://en.wikipedia.org/wiki/Post/Redirect/Get
比听起来简单得多。接收POST的CGI脚本只需输出以下内容:
状态:303查看其他
位置:http ://lalala.com/themainpage
As my first web app I developed a very simple survey. Random questions are being asked from the user anytime the page refreshes. The answer is sent to a cgi script using post to save the answers to the database.
However, when the user presses the submit button it automatically goes to the page which is responsible for processing the data and since it doesn't have any output it is a blank page. Now if the user wants to answer another question they have to press the "back" in the browser and refresh the page so a new question pops up. I don't want this.
I want it in a way that when the users pressed submit, the answers go automatically to the processing script and the page refreshes itself with a new question or at least after processing it redirects to the main survey page with a new question.
You want to implement this: https://en.wikipedia.org/wiki/Post/Redirect/Get
It's much simpler than it sounds. The CGI script that receives the POST must simply produce the following output:
Status: 303 See other
Location: http://lalala.com/themainpage
这篇关于网页使用CGI Python重定向到主页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!