无法使用php接收http post

无法使用php接收http post,php,mysql,Php,Mysql,我有一个包含php代码的网站,该代码将从http post接收到的值存储在数据库中 由三个文件组成 add.php(接收和存储) 警告您的代码已暴露于SQLInjection!!了解有关的语句。即使是这样也不安全!“我没有收到任何错误”。。此外,请确保没有收到错误消息。返回$connection;这个变量的值是多少?它应该是$mysqlithanks!是的,问题是$mysqli变量。我将研究如何防止sql注入,但这仍然是我调试php的一条线索。我无法使用chrome的inspect元素控制台,a

我有一个包含php代码的网站,该代码将从http post接收到的值存储在数据库中

由三个文件组成

add.php(接收和存储)


警告您的代码已暴露于SQLInjection!!了解有关的语句。即使是这样也不安全!“我没有收到任何错误”。。此外,请确保没有收到错误消息。返回$connection;这个变量的值是多少?它应该是$mysqlithanks!是的,问题是$mysqli变量。我将研究如何防止sql注入,但这仍然是我调试php的一条线索。我无法使用chrome的inspect元素控制台,add.php文件与index.php文件不同,后者包含html代码,您可以看到页面。Inspect元素不显示php文件,所以我无法像.js文件那样进行调试。
<?php
    include("connect.php");

    $link=Connection();

    $temp=$_POST["temp"];
    $lat =$_POST["lat"];
    $lng =$_POST["lng"];

    $query = "INSERT INTO `temptrac_temp` (`ID`, `temp`, `lat`, `lng`, `timestamp`) VALUES (NULL,'".$temp."', '".$lat."', '".$lng."', CURRENT_TIMESTAMP)";


    mysqli_query($link, $query);


    //mysqli_free_result($query);

    mysqli_close($link);

    header("Location: index.php");
?>
<?php

    function Connection(){


        $mysqli = new mysqli("localhost", "temptrac_temp", "temptrac_temp2846", "temptrac_temp");

        /* check connection */
        if ($mysqli->connect_errno) {
            printf("Connect failed: %s\n", $mysqli->connect_error);
            exit();
        }

        return $connection;
    }
?>
<?php

    include("connect.php");     

    $link=Connection();

    $result=mysqli_query($link, "SELECT * FROM `temptrac_temp` ORDER BY `timestamp` DESC");
?>



<p>Temperature Arduino checker</p>

<p>The temperature is:</p>  

<table class="normal" border="2" cellspacing="1" cellpadding="1">

    <tr>
        <td>&nbsp;Temperature&nbsp;</td>
        <td>&nbsp;Latitude&nbsp;</td>
        <td>&nbsp;Longitude&nbsp;</td>
        <td>&nbsp;Timestamp&nbsp;</td>

    </tr>

    <?php 
        if($result!==FALSE){
            printf("porcozio");
            while($row = mysqli_fetch_array($result)) {
                printf("<tr><td> &nbsp;%s </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td></tr>", 
                    $row["temp"], $row["lat"], $row["lng"], $row["timestamp"]);

            }
            mysqli_free_result($result);
            mysqli_close();
        }else{

            printf("there is an error");

        }
    ?>

</table>