How about, asking for your help one more time. I'm making a table where I show clients and each client has a button where they show their personal data, I'm doing it when I click on the button to open a modal window and show that information I do it in the following way:
$('#my_modal').on('show.bs.modal', function(e) {
var bookId = $(e.relatedTarget).data('book-id');
$(e.currentTarget).find('input[name="bookId"]').val(bookId);
});
<div class="container">
<form method="POST" action="#" name="form1" class="">
<h2>Clientes</h2>
<table class="table">
<thead>
<tr>
<th>Código</th>
<th>Nombre</th>
<th>RFC</th>
<th></th>
</tr>
</thead>
<?php
while ($res_c = sqlsrv_fetch_array($res_clientes)) {
?>
<tbody>
<td><?php echo $res_c['CIDCLIENTEPROVEEDOR']; ?></td>
<td><?php echo $res_c['CRAZONSOCIAL']; ?></td>
<td><?php echo $res_c['CRFC']; ?></td>
<td><p><a data-book-id="<?php echo $res_c['CCODIGOCLIENTE']; ?>" href="#my_modal" data-toggle="modal" class="btn btn-danger">Dirección</p></a></td>
</tbody>
<?php
}
?>
</table>
</div>
<!-- Ventana Modal-->
<!-- Modal Clientes -->
<div class="modal" id="my_modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">
<input type="text" name="bookId" value=""/>
</h4>
</div>
<div class="modal-body">
<input type="text" id="bookId" name="bookId" value="" />
<?php
$id_cliente = $_POST['bookId'];
echo $_POST['bookId'];
$sql_domicilios = "SELECT * FROM admDomicilios WHERE CIDDIRECCION = ".$id_cliente;
$res_domicilios = sqlsrv_query($con, $sql_domicilios);
$f_d = sqlsrv_fetch_array($res_domicilios);
?>
<p>Estado: </p>
<p>Colonia: </p>
<p>Calle: </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
</form>
You already send the client's ID to the input text, now my problem is that when making $ _POST ['bookId']; to pass it to a variable and make conditions tells me that it is not found .. I appreciate your attention and help.