Problem with code sent by POST

0

I'm developing a system, and I need to store a code to a certain item and this code that passes through POST, is not being saved in the bank, the same when it is passed, the item is saved, however in the column of this code it is zeroed . Here are codes:

The FORM SENDING:

<div id="gravaeditapauta">
    <form action="gravarpauta.php" method="POST">

   <?php
    include ("conectarbanco.php");

    $passacodigoreuniao=$_GET["addcodpauta"]; 
    $selecionalinha= mysqli_query($conexao, "SELECT Data FROM reuniao where CodReuniao=$passacodigoreuniao");
    $campo= mysqli_fetch_array($selecionalinha);

    ?>

    <input type="hidden" name="CodReuniao" value="<?=$campo["CodReuniao"]?>">
    <label for="data">Data da Reunião:</label>&nbsp &nbsp<input type="text" name="data" size="20" maxlength="10" readonly="readonly" value="<?=$campo["Data"]?>">
    <br></br>

    <label for="DescItem">Inserir Item de Pauta:</label>&nbsp &nbsp<input type="text" name="DescItem" size="50" maxlength="50">

    <br></br>

<input type="Submit" name="submit" value="Gravar Item de Pauta">

</form> 
</div>  

The command block for insertion into the database:

<?php

include ("conectarbanco.php");

$passacodigoreuniao=$_POST["CodReuniao"];
$data=$_POST["data"];
$DescItem=$_POST["DescItem"];

mysqli_query($conexao,"INSERT INTO itenspauta(DescItem,CodReuniao) values ('$DescItem','$passacodigoreuniao')") or die (mysqli_error($conexao));

?>
    
asked by anonymous 01.10.2018 / 03:12

1 answer

0

Hello, Change the following line:

$ seleccionalinha = mysqli_query ($ connection, "SELECT Data FROM reunion where CodReuniao = $ passacodigoreuniao");

For this: $ SELECT = mysqli_query ($ connection, "SELECT Date, CodReunion FROM reunion where CodReuniao = $ passacodigoreuniao");

You forgot to include the CodReuniao

Abcs

    
01.10.2018 / 04:21