Your code is wrong. You are setting the value of $_SESSION['nome']
with a $_POST
that does not yet exist and the same situation is repeated when calling 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 tag </body>
put 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>";
}
?>
No popup need change anything.
Just for the record: I don’t recommend using popup, because most modern browsers block all by default and, less experienced users don’t know how to do so that they are displayed.
try to put
action="NomeDoPopUp"
in your form.– RFL
keeps giving the same problem and in addition has one more thing, page 1 is a form that makes an entry in the database and only after this entry is created an ID (autoincremental) that I will use in the popup... so the action of the first form can not be the popup... =/
– Heathz
I’ll try to explain the case. Page1: makes the main register automatically generating a code in the table of the bank Page2 (popup): brings a list of checkboxes with options and that will be linked to the code I mentioned above in another table of the bank Because of this I need the first form to be sent first and only then another page comes with the check. Popup is only an aesthetic matter, not to open a page only for this... if you have any other solution)
– Heathz