链接回访问的表单b

2024-05-15 23:18:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在努力学习Python,目前正在练习51。其中,要求学生添加文件模板/索引.html链接返回,这样我们就可以继续填写表单并查看结果。我的代码如下:

/bin
    app.py
/static
/templates
    hello_form.html
    index.html
/tests

在应用程序副本内容如下:

^{pr2}$

在索引.html内容如下:

$def with (greeting)

$if greeting:
    I just wanted to say <em style="color: green; font-size: 2em;">$greeting</em>
$else:
    <em>Hello</em>, world!

你好_表单.html内容如下:

<h1>Fill out this form</h1>

<form action="/hello" method="POST">
    A Greeting: <input type="text" name="greet">
    <br/>
    Your Name: <input type="text" name="name">
    <br/>
    <input type="submit">
</form>

这个链接是表单上的按钮,不是吗? 如何为这个按钮添加处理程序?在

提前谢谢你的帮助。在


Tags: textnamebrform表单内容helloinput
3条回答

这可以用基本的html来完成。如下所示:

<form method="get" action="/page2">
  <button type="submit">Continue</button>
</form>

应该做这个工作。在

在最后一个正文标记之前输入:

<a href = "http://localhost:8080/hello">Link to Hello</a>

这样你就可以回到表单页面了。在

我加了这几行索引.html而且成功了。在

    <form> 
        <input type="button" value="Back" onclick="history.back()">          
    </form>

有关详细信息,请访问https://www.computerhope.com/issues/ch000317.htm

希望有帮助。在

相关问题 更多 >