我在Flask中使用这个表单,到目前为止工作正常:
<form action = "/guess/" method = "post">
<p>Your guess:</p>
<p><input type = "text" name = "guess" /></p>
<p><input type = "submit" value = "Submit" /></p>
<p>{{ guess }}</p>
<p>{{ used }}</p>
<p>{{ user}}{{ score }}</p>
</form>
但是可以使按钮发送字符串“示例”到我的脚本吗?
<form action = "/guess/" method = "post">
<p>Your guess:</p>
<p><input type = "text" name = "guess" /></p>
<p><input type = "submit" value = "Submit" /></p>
<p>{{ guess }}</p>
<p>{{ used }}</p>
<p>{{ user}}{{ score }}</p>
<button type="submit" value="example" name="guess">Example</button>
</form>
我需要将某些字符串发送到我的脚本
好的,我现在得到它,在我的烧瓶python脚本中:
guess = request.form["guess"]
要求它的价值。必须删除重复的请求:
<form action = "/guess/" method = "post">
<p>Your guess:</p>
<p>{{ guess }}</p>
<p>{{ used }}</p>
<p>{{ user}}{{ score }}</p>
<button type="submit" value="example" name="guess">Example</button>