Hello,
I'm trying to display a random number with rand () after inserting it into the database. the insertion in mysql works normally, but when I try to display a message with the $ request variable nothing is shown.
If I insert something into the database using a variable, does that variable become empty after insertion?
Here is the code.
<?php
$codigo = $_POST['codigo'];
$produto = $_POST['produto'];
$valor = $_POST['valor'];
$pedido = rand(1,400);
if (insereProduto($conexao, $codigo, $produto, $valor, $pedido)) { ?>
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
Pedido salvo com sucesso!
</div>
<?php
} else { ?>
<div class="alert alert-success" role="alert">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
Pedido salvo com sucesso!, O numero do pedido é <?php= $pedido; ?>
</div>
<?php
}
?>
<br />
<button class="btn btn-warning" onClick="javascript:window.location.href='novo-pedido.php'">Fazer novo pedido</button>