I can not pass an id to a modal window. Could you help me?
The code for the main page code is this:
menu.php
$id= $_GET["id"];
<div style="text-align: center"><a href="#pagina1" class="btn_modal">
<h3>VER MAIS</h3></a></div>
<div id="modal">
<div class="box-modal">
<div class="box-modal-load"></div>
<div class="fechar">X</div>
</div>
</div>
This is the script that runs:
menu.php
<html>
<script type="text/javascript">
$(document).ready(function(e) {
$('.btn_modal').click(function(e){
e.preventDefault();
var url = $(this).attr('href')
$('.box-modal-load').load("pagina.php "+url);
$('#modal').fadeIn(500);
});
$('#modal, .fechar').click(function(e){
if( e.target !== this )
return;
$('#modal').fadeOut(500);
});
});
</script>
</html>
This is the modal window
page.php
<?php
$id = $_GET["id"];
$query4 = "SELECT
*
FROM
tabela
WHERE
idpessoa = $id";
$resultado4 = consultaQuery4($query4);
function consultaQuery4($query4)
{
include_once 'conexao2.php';
$consultaQuery4 = mysqli_query($connect, $query4);
return $consultaQuery4;
}
?>
<div id="pagina1">
<h1>Avaliações</h1>
<div class="avaliacaomodal">
<table class="table2modal">
<thead>
<tr>
</tr>
</thead>
<tbody class="cptabelaavamodal">
<?php while($ava = mysqli_fetch_array($resultado4)):?>
<tr class="registrosavamodal">
<td id="imgusermodal"><img src='<?php echo $ava['imagem'];?>' width="100" height="100"><?php echo nl2br ("<h7>".$ava['nome']."\n".$ava['data']."</h7>");?></td>
<td id="tabelaavamodal"><?php echo nl2br ("<h4>".$ava['comentario']."</h4>"."\n\n"."<h3>".$ava['nomeret']."\n".$ava['replica']."</h3>");?></td>
<td id="colunanotamodal"><?php echo nl2br ("<h1>".$ava['nota']."</h1>");?></td>
</tr>
<?php endwhile;?>
</tbody>
</table>
</div>