按钮未在模态中触发

时间:2016-07-11 10:04:12

标签: php

我正在使用" a"打电话给模态:

ausencias.php

echo ' <a href="edit.php?aus='.$ausenciaid.'" title="Aprovar" class="simple-ajax-modal btn btn-defaul"><i class="fa fa-pencil"></i></a>';

edit.php:

<html>
<?php
If(isset($_GET['aus'])) {

//BASE DE DADOS
include("connection.php");

$aprovar=$_GET['aus'];

$resultado=mysqli_query($db, "SELECT * 
                              FROM contas as a, ausencia as h 
                              WHERE a.id = h.id 
                                AND h.idausensia='$aprovar'");  

while($row = mysqli_fetch_array($resultado)){
    $noome=$row['nome'];
    $pic=$row['pic'];
    $datasaida=$row['datasaida'];
    $datavolta=$row['datavolta'];
    $motivo=$row['tipos'];
    $ficheiro=$row['justfile'];
}
?>



<div id="custom-content" class="modal-block modal-block-md">
    <section class="panel">
        <header class="panel-heading">

            <h2 class="panel-title">Visualização de Pedido de Ausência - <?php echo($noome)?> </h2>

        </header>
        <div class="panel-body">
            <div class="row">
                    <div class="col-md-3">
                <br>
                    <center><img class="img-responsive" src="<?php echo($pic) ?>" /></center>
                    <br>
                </div>
                <div class="col-md-22">

                </div>
            </div>

            <div class="row">

                <div class="col-md-40">
                     <div class="panel-body">


                                        <div class="form-group">
                                            <label class="col-md-3 control-label" for="inputReadOnly">Nome</label>
                                            <div class="col-md-6">
                                                <input type="text" value="<?php echo($noome) ?>" id="inputReadOnly" class="form-control" readonly="readonly">
                                            </div>
                                        </div>
                                          <div class="form-group">
                                            <label class="col-md-3 control-label" for="inputReadOnly">Comprovativo</label>
                                            <div class="col-md-6">


                                              <a class="mb-xs mt-xs mr-xs btn btn-primary" href='download.php?down=<?php echo($ficheiro)?>'><i class="fa fa-cloud"></i> Baixar</a>
                                            </div>
                                            <br><br>
                                            </div>
                                            <div class="form-group">
                                            <label class="col-md-3 control-label" for="inputReadOnly">Motivo</label>
                                            <div class="col-md-6">
                                                <input type="text" value="<?php echo($motivo) ?>" id="inputReadOnly" class="form-control" readonly="readonly">
                                            </div>
                                        </div>
                                                                                <div class="form-group">
                                            <label class="col-md-3 control-label" for="inputReadOnly">Inicio Ausência</label>
                                            <div class="col-md-6">
                                                <input type="text" value="<?php echo($datasaida) ?>" id="inputReadOnly" class="form-control" readonly="readonly">
                                            </div>
                                        </div>
                                                                                <div class="form-group">
                                            <label class="col-md-3 control-label" for="inputReadOnly">Fim Ausência</label>
                                            <div class="col-md-6">
                                                <input type="text" value="<?php echo($datavolta) ?>" id="inputReadOnly" class="form-control" readonly="readonly">
                                            </div>
                                        </div>
   <br>
   <br>
                                         <footer class="panel-footer">
                                        <div class="row">
                                            <div class="col-sm-9 col-sm-offset-3">
                                            <form action="" method="post">
                                                <input type="submit" value="Test" name="confirmar">
                                                <button class="btn btn-default modal-dismiss">Sair</button>
                                                <button name="recusar" type="button" class="mb-xs mt-xs mr-xs btn btn-danger">Recusar</button>
                                            </form>

                                            </div>
                                        </div>
                                    </footer>



                     </div>
                </div>
            </div>
        </div>
        <?php
        if(isset($_POST['confirmar'])){
    mysqli_query($db, "UPDATE ausencia SET estados='Rascunho' WHERE idausensia='$aprovar'");
    mysqli_close($db);
    header("Location: ausencias.php");


                     }

        ?>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-md-12 text-right">

                </div>
            </div>
        </footer>
    </section>
</div>



<?php }?>
<html>

但由于某种原因,Isset不适用于该按钮,但当我删除I​​f时,SQL语句有效。当我点击按钮时,它只关闭模态,不要触发If。

中的内容

任何人都可以帮助我吗?

如果不起作用的是:

       if(isset($_POST['confirmar'])){

1 个答案:

答案 0 :(得分:0)

<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

<!-- Modal content-->
<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">&times;</button>
    <h4 class="modal-title">Modal Header</h4>
  </div>
  <div class="modal-body">
    <p>Some text in the modal.</p>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  </div>
</div>

你在锚点的href中添加直接的php文件,它会在目标页面上重定向你使用Bootstrap的Simply Modal窗口。