I have a modal that opens from a button which comes with the id of the post. I store this id in an input type "hidden", in the modal.
My problem is having this field already loaded with the post id selected. How can I filter data from a DB 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 since I need to load the value of the field in 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>';
}
?>
And here is my solution:
HTML
JAVA SCRIPT
PHP