Пример #1
0
if ($acao == "excluir" && $codigo > 0) {
    if ($ficha->excluir($codigo)) {
        echo "<script>window.location = 'listagem.php';</script>";
    } else {
        echo "<script>\n                    alert('Erro ao excluir o cadastro. Verifique as dependências e tente novamente.');\n                    window.location = 'listagem.php';\n                  </script>";
    }
}
if ($_POST) {
    if ($codigo == 0) {
        if ($ficha->incluir()) {
            echo "<script>window.location = 'listagem.php';</script>";
        } else {
            echo "<script>alert('Erro ao incluir!')</script>";
        }
    } else {
        if ($ficha->alterar()) {
            echo "<script>window.location = 'listagem.php';</script>";
        } else {
            echo "<script>alert('Erro ao alterar!')</script>";
        }
    }
}
?>

  <link rel="stylesheet" href="../css/bootstrapValidator.min.css"/>
  
  <script>
  $(document).ready(function() {
      $('#form_cad')
          .bootstrapValidator({
              // Only disabled elements are excluded