I have a modal that opens from a button which comes with the id of the post. This id stores it in an input type "hidden", in the modal.
My problem is having this field already loaded with the selected post id How can I filter data from a database using the value of that field?
this is the input:
<input type="hidden" id="obtenerIdPost" name="idC">
PHP
As you can see, the query is not complete because I need to load the value of the field into a variable, to do the filtering.
<?php
$query_buscar_posts = mysqli_query($conn, " SELECT * FROM comentarios WHERE id_post = ") or die('Error: ' . mysqli_error($conn));
while ($posts_filas = mysqli_fetch_array($query_buscar_posts)) {
$contenido2 = $posts_filas['contenido'];
echo ' <p class="aaaaa"> '.$posts_filas['contenido'].'</p>';
}
?>