To perform your database query based on the input and open the result in another window, do the following:
Your input must be inside a tag <form>
that has an attribute target="_blank"
. Your page will look something like this:
<form action="novaTela.php" method="post" target="_blank">
<input type="text" name="txtPesquisa" id="txtPesquisa" />
<inut type="submit" name="btnEnviar" value="Enviar" />
</form>
In this example, we are sending the input to the new pageTela.php. You should schedule the database call on this new page.
FILE novaTela.php:
<?php
$txtPesquisa = $_POST['txtPesquisa'];
echo "FAZER A CONSULTA NO BANCO DE DADOS";
?>
For academic purposes: the attribute target
tag <form
allows us to assign the following values:
_self: If no value is entered, _self is the default value. It sends the form to the same form page;
_Blank: it sends the form to a new page (specify which page through the attribute action
;
_Parent: sends the form to the page that called new window;
_top: sends the form to the page that called the frame
;
framename: send the form to a frame
specific;