You can tell me how to finish this project, with this code I have been able to define the message that will appear from the number entered by the user given by the administrator
<form action="submit.php" method="post" >
<nav class="zz z_meio2 borda ">
insira o código especifico ou deixe em branco para resposta padrão
<br>
<input type="text" name="CODNOME"><br>
<button type="submit" >Enviar</button>
</nav>
</form>
The code I'm using in submit.php
<?php
//função para gerar respostas
echo $CODNOME;
if($_POST['CODNOME'] == "001"){
$msg = "mensagem1";
}
else if($_POST['CODNOME'] == "002"){
$msg = "mensagem2";
}
else {
$msg = "opção fixa";
}
echo $msg;
?>
The above code redirects to another page.
But I would like that if the user types an invalid code or does not type anything it prints the "fixed msg" by printing it without changing page by clicking on the code below.
<input type="submit" value="Imprimir" class="btn no-print" onClick="window.print()">
<div class="print" STYLE="width:660px;">
<p>msg fixa</p>
</div>
This would be as if the result of submit.php was the user's impression, on the same page, do you have any way to do that?