0
The code below is working very well, but it shows the result in his page Submit.php.
    <?php
    // submit.php
    echo $CODNOME;
    if($_POST['CODNOME'] == "001"){
      $msg = "mensagem1";
    } 
    else if($_POST['CODNOME'] == "002"){
      $msg = "mensagem2";
    }
    else {
      $msg = "opção fixa";
    }
    echo $msg;
   ?>
what I would like is for him to run the function in Submit.php and then come back with the result to print.php in div print
<!-- imprimir.php !-->
<form method="post" id="CODNOME" action="submit.php">
      <nav class="zz z_meio2 borda ">
  insira o codigo
<br>
      <input type="text" name="CODNOME" id="CODNOME"><br>
      <button type="submit" >Enviar</button>
      </nav>
    </form>
<div class="print" STYLE="width:660px;">
  <?php echo $msg;?>
     <p>*conteúdo html e php</p> 
</div>
then how to create a javascripit to get the data entered by the user in the print.php send to Submit.php and bring with the result in the div print ?
did not work because I tried exactly is to do the processing of this php code in javascript.
– Luccas Cerqueira
@Luccascerwhether my answer is valid. You can use ajax or the mentioned code. It will send directly to the print page and place the $msg variable in the div. Edit your answer and explain better what you need if the answer hasn’t served (y).
– Marcelo Ágil