Your code is wrong. You are setting the value of $_SESSION['nome']
with a $_POST
that does not even exist and the same situation repeats when you call the popup.
Do so
<?php
session_start('professor');
$chamarPopup = false;
//Verifica se existe um $_POST chamado nomeP, que é o name do seu input.
if (isset($_POST['nomeP']) && !empty($_POST['nomeP'])) {
$_SESSION['nome'] = $_POST['nomeP'];
$chamarPopup = true;
}
?>
<form method="post" name="formTest">
<input type="text" name="nomeP" value="Nome Professor">
<input type="submit" value="PopUp">
</form>
At the end of your page, after the </body>
tag, place this
<?php
if ($chamarPopup === true) {
echo "<script>window.onload = function(){";
echo "varWindow = window.open ('cadastro_prof_disc.php', 'popup', 'width=1024, height=350, top=300, left=400%, scrollbars=no, resizable=yes,')";
echo "};</script>";
}
?>
In the popup you do not need to change anything.
Just to state: I do not recommend using popup because most modern browsers block all by default, and less savvy users do not know how to make them appear.