0
My question is the following, I have a select that your options are built from the data in the database:
<select id="cCoo" name="tCoo">
<option style="font-style: italic" id="dsb" disabled elected>Selecione...</option>
<?php
include('../configBD.php');
$sql = "select * from coordenador";
$result = mysqli_query($conexao, $sql) or die(mysqli_error());
while ($dados = mysqli_fetch_array($result)){
$codigo = $dados['idCoo'];
$nome = $dados ['tNomCoo'];
echo "<option value='$codigo'>$nome</option>";
}
?>
</select>
The insertion of new data is done from a button on the same page that opens a pop-up and the user can register a new coordinator as in the example below.
Let’s assume that the user registers a new coordinator, closes the registration page and needs to select the coordinator that he had just entered into the bank. The problem is exactly this... To refresh the options I put a refresh button there, and I need a function that refreshes the options, IE, without the user need to update the whole page causing what it had filled to get lost.
Does this refresh button function in javascript? If so, you can run this function via
opener
. Take a look at the end of this page: https://www.w3schools.com/jsref/met_win_open.asp– LipESprY
Actually this refresh button is just a link with a refresh icon, it has no pre-established function, it is exactly in it that I want to put a function to reload the data coming from the database in the options.
– Carlos Eduardo Silva
An idea would be you build this
select
via ajax and call that function after adding new option in the extra window. Then you will call the main page viajavascript
as mentioned in the previous comment:janelinhaExtra.opener.construirSelect()
;– LipESprY
Let me see if I understand, after the user put the data, name, number, etc, etc, the moment he press the send button there from the window (pop-up) besides entering the data in the database I do a function to refresh the entire main page? But there would not fall into that situation imposed, in which if the whole page is updated everything that the user has already entered in the form will be reset. I need that when entering a new data only options are updated, or can be using that refresh button even, no problem.
– Carlos Eduardo Silva