Save button with option

Asked

Viewed 51 times

-3

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

$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());

1 answer

2


This way you can help, only you will not be explicitly "yes" and "no" options. The following code is working to open the respective pages according to the chosen option:

$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>";
}
  • Yes, Yes opens an html x page and does not open an html y page

  • Only one question to open the page on the same tab? Make the page popup with the question and then open on the page where it was

Browser other questions tagged

You are not signed in. Login or sign up in order to post.