11 <form method="POST" action="/home">
12 <p>请留言</p>
13 ¦ <table>
14 <tr>
15 <th>名字</th>
16 <td><input type="text" size="20" name="name"></td>
17 </tr>
18 <tr>
19 <th>留言</th>
20 <td><textarea rows="5" cols="40" name="comment"></textarea></td>
21 </tr>
22 ¦ </table>
23 ¦ <p><button type="submit" onclick="alert('提交成功!')">提交</button></p>
24 </form>
这是我的html上的代码
2 @application.route('/home',methods=['GET','POST'])
33 def index():
34 '''首页'''
35 if request.method == 'GET':
36 ¦ greating_list = load_data()
37 ¦ return render_template('index.html',greating_list = greating_list)
38 if request.method == 'POST':
39 ¦ name = request.form.get('name')
40 ¦ comment = request.form.get('comment')
41 ¦ create_at = datetime.now()
42 ¦ sava_data(name, comment, create_at)
不知道为什么根本接收不到POST请求
我拷贝了你的代码 运行没有问题。