简体   繁体   English

通过表单提交数据时的HTTP 406响应

[英]HTTP 406 Response when submitting data through form

When I submit data through my form I get a 406 Not Acceptable response. 通过表单提交数据时,我收到406不可接受的响应。

This is the form: 形式如下:

<form method="post" action="ucp.php?action=p">


        <fieldset>

        <legend>Post Here:</legend>

            <label type="hidden" for="title">Title:</label><br />

            <input type="text" name="title"><br /><br />';


        $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('could not connect to mysql '.mysqli_connect_error());

        echo'<select id="category" name="category">';

        $query = "SELECT * FROM categories";

        $data = mysqli_query($dbc, $query);

        while ($row = mysqli_fetch_array($data)) {

            echo '<option value="'.$row['cat_id'].'">'.$row['name'].'</option>';

        }

        echo'</select><br /><br />';

        mysqli_close($dbc);



        echo'<label type="hidden" for="post1">Post Content:</label><br />

        <textarea rows="4"  name="post1" id="post1" cols="50"></textarea><br />

        </fieldset>

        <input type="submit" value="Save Post" name="submit" />     

    </form>

This is what I'm trying to submit: 这是我要提交的内容:

Planning on making more updates to the site. These include:

[code]
Adding status update to profile page (User can update their status, kind of like a skype mood message)
[/code]

If I put (almost) anything else in it comes out correctly and submits to the database but this gives me the 406 error. 如果我将(几乎)其他任何内容正确地输出并提交给数据库,但这会给我406错误。 I tried disabling Mod Security but that isn't allowed by my host. 我尝试禁用Mod Security,但是主机不允许这样做。

EDIT: 编辑:

When I remove the ':' from what is being submitted it works. 当我从正在提交的内容中删除“:”时,它将起作用。

Read your code. 阅读您的代码。 You appear to be missing 您似乎失踪了

<?php
?>

In the appropriate places. 在适当的地方。 Consequently you are submitting a mixture of html and php together. 因此,您将同时提交html和php。 I'm not surprised that it is rejecting it. 我拒绝它并不感到惊讶。 It probably thinks that you are trying to inject the system. 它可能认为您正在尝试注入系统。

The lines between mysql_connect and mysql_close are php code. mysql_connect和mysql_close之间的线是php代码。 I have no idea what that final echo is doing. 我不知道最后的回声在做什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM