php mysql $_post does not work -


i have written code, not work , cannot find mistake. filters data mysql database. below pasted 1 code without $_post form , works fine. need filter due high volume of data.

`

        include "db_connect.inc.php";      $sql = "select versicherungsnamen, franchise, praemie praemien";     $sql .= " kanton = " . $_post["kanton"]         . " , franchise = ". $_post["franchise"];     $sql .= " order praemie";      $res = mysqli_query($con, $sql);     $num = mysqli_num_rows($res);     if ($num==0) echo "keine datensätze gefunden";      while ($dsatz = mysqli_fetch_assoc($res))     echo $dsatz["versicherungsnamen"] . ", "         . $dsatz["praemie"] . "<br />";           mysqli_close($con);          ?>     </body> </html>` 

but when try code without $_post option works fine

    <html>     <body>         <?php include "db_connect.inc.php"; $res = mysqli_query($con, "select versicherungsnamen, franchise, praemie praemien"); while ($dsatz = mysqli_fetch_assoc($res))     {     echo $dsatz["versicherungsnamen"] . ","         .$dsatz["franchise"] . ","         .$dsatz["praemie"] . "<br />";      } ?>     </body> </html> 

before select replace post vars separate variables use new vars in select query.

$kanton = $_post['kanton']; $franchise = $_post['franchise'];  $sql = "select versicherungsnamen, franchise, praemie praemien kanton = " . $kanton . " , franchise = ". $franchise. " order praemie"; 

...


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -