Php 引导模式中的窗体';t在MySQL中插入数据

Php 引导模式中的窗体';t在MySQL中插入数据,php,html,mysql,bootstrap-modal,Php,Html,Mysql,Bootstrap Modal,我试图用一个处于引导模式的表单将数据插入MySQL,但它不起作用 我不知道为什么,但我的表单方法是POST,它似乎是GET,因为它在web地址中打印数据 当我尝试使用相同的php代码(没有格式,非常简单)通过基本表单插入数据时,它会插入数据 这是我在引导模式中的表格 <div class="container 2"> <button type="button" class="btn btn-primary btn-lg btn-block" data-toggle="moda

我试图用一个处于引导模式的表单将数据插入MySQL,但它不起作用

我不知道为什么,但我的表单方法是POST,它似乎是GET,因为它在web地址中打印数据

当我尝试使用相同的php代码(没有格式,非常简单)通过基本表单插入数据时,它会插入数据


这是我在引导模式中的表格

<div class="container 2">
<button type="button" class="btn btn-primary btn-lg btn-block" data-toggle="modal" data-target="#newRoute">
    CREAR NUEVA RUTA
</button>


<div class="modal fade" id="newRoute" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-md" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <div class="container-fluid">
                    <div class="row">
                        <form class="route" method="post">
                            <div class="col-md-6 col-sm-6 col-xs-6">
                                <div class="form-group">
                                    <label for="name">Ponle un nombre a la ruta</label>
                                    <input type="text" class="form-control" id="name" name="name" required>
                                </div>
                                <div class="form-group">
                                    <label for="city">Ciudad</label>
                                    <input type="text" class="form-control" id="city" name="city" required>
                                </div>
                                <div class="form-group">
                                    <label for="length">Distancia</label>
                                    <input type="text" class="form-control" id="length" name="length" required>
                                </div>


                            </div>
                            <div class="col-md-6 col-sm-6 col-xs-6">
                                <div class="form-group">
                                    <label for="start_point">Punto de salida</label>
                                    <input type="text" class="form-control" id="start_point" name="start_point"
                                           required>
                                </div>
                                <div class="form-group">
                                    <label for="difficulty">Dificultad</label>
                                    <input type="text" class="form-control" id="difficulty" name="difficulty"
                                           required>
                                </div>
                                <div class="form-group">
                                    <label for="date">Fecha de la ruta</label>
                                    <input type="date" class="form-control" id="date" name="date" required>
                                </div>
                            </div>


                            <div class="col-md-12 col-sm-12 col-xs-12">
                                <div class="form-group">
                                    <label for="description">Detalles de la ruta</label>
                                    <textarea class="form-control" rows="5" id="description"
                                              name="description"></textarea>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <div class="form-group">
                                    <button type="submit" name="submit" id="submit" class="btn btn-primary"
                                            value="Enviar">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
提前谢谢

当我提交表格时,这是地址中显示的内容(所有字段都由示例文本填充)。这似乎是一个得到形式

http://localhost/Proyecto/routes.php?name=Test&city=Test&length=20&start_point=Test&difficulty=Test&date=2018-05-12&description=Test+description&submit=Enviar

请尝试检查您是否忘记关闭代码中应具有
method=“get”
或不具有method属性的任何其他表单 因此,当您提交数据时,它会从该表单中获取方法。
您在此处发布的代码应该可以正常工作

您的表单代码是正确的,我已经在我的系统上检查过了。您必须检查/测试其他页面或表单。

定义表单操作可能的重复项,但不能重复。我定义了表单操作,但它仍然作为GET,因为它在web地址中写入表单数据。这段代码看起来不错,因为您需要表单操作,这里的方法是很好的解释,是这样的。我在导航栏的上方打开了一个表单,并在删除它后继续工作。谢谢
$conn = new mysqli('localhost', 'root', "", 'users');

if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
http://localhost/Proyecto/routes.php?name=Test&city=Test&length=20&start_point=Test&difficulty=Test&date=2018-05-12&description=Test+description&submit=Enviar