Record button with option

-3

I have a save button in the html that serves to save the data of a form in the DB but after saving I want it to open a window asking: "New registration?" with two options with yes and no. If yes opens the page x if it does not open the page and

$sqlinsert = "INSERT INTO tb_detalhe_trabalhador VALUES(0,'".$Tecnico."','".$Seguranca."','".$Nome1."','".$Funcao1."','".$Nome2."','".$Funcao2."','".$Nome3."','".$Funcao3."','".$Nome4."')" ;      



mysql_query($sqlinsert) or die(mysql_error());
//mysql_query($sqlinsert2) or die(mysql_error());
    
asked by anonymous 11.06.2014 / 21:18

1 answer

2

That way you can help, the options "yes" and "no" will not be explicitly explicit. The following code is working to open their pages, depending on the option chosen:

$insert = mysql_query("INSERT INTO tb_detalhe_trabalhador VALUES(0,'".$Tecnico."','".$Seguranca."','".$Nome1."','".$Funcao1."','".$Nome2."','".$Funcao2."','".$Nome3."','".$Funcao3."','".$Nome4."')" 
          or die(mysql_error());

if ($insert)
{
    echo "<script>var r = confirm('Novo Registro?');" .
    "if (r == true) {window.open('page-x.html');}" .
    "else {window.open('page-y.html');}</script>";
}
    
11.06.2014 / 21:56