来自HTML表单的空POST请求(Python)

2024-06-16 13:13:25 发布

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

尝试在BaseHttam模块中使用BaseHttam处理程序接收请求。我写了一个简单的HTML表单:

{<1分$ <html> <head> <meta charset='UTF-8'> </head> <body> <form action="http://localhost:8080/" method='post'> <strong>Access point</strong><br> <label for='ssid'>SSID: </label> <input type='text' id=ssid><br> <label for='passphrase'>Passphrase: </label> <input type='password' id=passphrase><br> <br> <strong>Calendar</strong><br> <label for='id'>ID: </label> <input type='text' id=calid><br> <br> <input type='submit'> <input type='reset'> </form> </body> <html>

以及最低限度的应用:

^{pr2}$

问题是everypost请求是空的。我得到内容长度=0。在


Tags: textbrformidforinputhtmltype
1条回答
网友
1楼 · 发布于 2024-06-16 13:13:25

请为表单元素提供名称属性,并查看它是否有效。在

<html>
    <head>
        <meta charset='UTF-8'>
    </head>
    <body>
        <form action="http://localhost:8080/" method='post'>
            <strong>Access point</strong><br>
            <label for='ssid'>SSID: </label>
            <input type='text' id="ssid" name="ssid"><br>
            <label for='passphrase'>Passphrase: </label>
            <input type='password' id="passphrase" name="passphrase"><br>
            <br>
            <strong>Calendar</strong><br>
            <label for='id'>ID: </label>
            <input type='text' id="calid" name="calid"><br>
            <br>
            <input type='submit'>
            <input type='reset'>
        </form>
    </body>
<html>

相关问题 更多 >