php - How to pass a value as parameter using data-target = "# myModal"? -
i have this
<?php if($natureza == 'con'){ ?> <a data-toggle="modal" href="?param=<?=$id_serv?>#mymodal" data-target="#mymodal"> click me</a> <?php } ?> works, modal opens perfectly
but, how can receive "param" value in modal ?
like this
<?php if(isset($_get["param"])){ $id = $_get["param"]; } i have no idea.
more
<table class="table table-bordered table-striped"> <thead> <tr class="info"> <th>id</th> <th>matrícula</th> <th>nome</th> <th>natureza</th> <th>escolaridade</th> <th>função</th> <th>simb / nível</th> <th>curriculum</th> </tr> </thead> <tbody> <?php $sqlstat = $mysqli->prepare("select id_serv,simb,nivel,func,mat,fnome,lnome,grau,natureza tbl_v_servidores local = '$sigla' "); $sqlstat->execute(); $sqlstat->bind_result($id_serv, $simb, $nivel, $func, $mat, $fnome, $lnome, $grau, $natureza); $i =0; while ($sqlstat->fetch()) { $i = $i + 1; if($nivel == 0){ $nivel = ''; } ?> <tr> <td><?=$i?></td> <td><?=$mat?></td> <td><?=$fnome?> <?=$lnome?></td> <td><?=$natureza?></td> <td><?=$grau?></td> <td><?=$func?></td> <td><?=$simb?> <?=$nivel?></td> <td> <?php if($natureza == 'con'){ ?> <a data-toggle="modal" href="?param=<?=$id_serv?>#mymodal" data-target="#mymodal">click me</a> <?php } ?> </td> </tr> <?php } ?> </tbody> </table> in window modal
<div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria- labelledby="mymodallabel" aria-hidden="true" > <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria- hidden="true"> x </button> <h4 class="modal-title" id="mymodallabel">curriculum</h4> </div> <div class="col-sm-12"> <?php if(isset($_get["param"])){ $id = $_get["param"]; } then, in way, use param variable make stop @ bank select , build modal page
but, how can receive "param" value in modal ?
there no way can receive value of "param" unless make request.
and since anchor
<a data-toggle="modal" href="?param=<?=$id_serv?>#mymodal" data-target="#mymodal"> click me</a> uses markup bootstrap modal query, won't make redirect request because trigger visibility of modal.
as far can uderstand problem, trying value of "param" when click anchor. again, there no way can receive value of "param" unless make request.
use ajax or jquery.
Comments
Post a Comment