Error sending form to save

Asked

Viewed 37 times

0

You are generating the following error by submitting my record form: Notice: Undefined index: client in C: xampp htdocs guaraparivirtual Adm-gc write-text.php on line 3

This code below $idcli = $_GET['cliente']; is the client code I get from another page before I get here. The next code also needs to receive this parameter to save the data to the correct client, and this is where it generates the error, because this parameter is passed by action form.

Form page:

<?php
$idcli = $_GET['cliente'];
?>
<?php
$painel=mysqli_query($con,"select detalhe_sobre from anuncios where id = '$idcli'");
while($painel_texto=mysqli_fetch_array($painel)){
$texto_empresa = $painel_texto['detalhe_sobre'];
}
?>
<form class="frm-adm-painel" action="gravar-texto.php?cliente=<?php echo $idcli; ?>">
    <textarea name="textoempresarial" rows="10" placeholder="Texto sobre a Empresa">
    <?php echo utf8_encode(strip_tags(nl2br($texto_empresa)));  ?>
    </textarea>
    <button type="submit">GRAVAR</button>
</form>

Page that generates the error:

The line that generates the error is this: $idcli = $_GET['cliente'];

<?php
$idcli = $_GET['cliente'];
?>
<?php
if (isset($_POST["submit"])){
    echo "Gravado com sucesso";
}
?>
  • Duplicated? In the other post it does not show something that corrects the mistake given with me! There is another totally different situation.

  • It’s the same problem, on the first call of your page $_GET['cliente'] does not exist soon was the Undefined index, you need to check if it exists and has value (can be with the empty()), also need to skip the query block if it does not exist. pq does not send the id via post?

  • How I would send via post?

  • Create an Hidden input anyway you will need the logic of the previous comment. You can leave this suggestion to the end.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.