Trying to pass variable into a HTML modal, run a query and display info based on the id... I can pass the parameter into the HTML with this but I need it at the end of a SQL WHERE statement at the end of a query...
my script is here. Im thinking I need some ajax to accomplish this. I created a fiddle
http://jsfiddle.net/rbla/y7s5tf3p/
<script>
$(document).on("click", ".open-AddBookDialog", function () {
var myBookId = $(this).data('id');
//$(".modal-body #bookId").val( myBookId );
document.getElementById("bookId").innerHTML = myBookId;
});
</script>
The variable gets inserted into the HTML , but I need to get the data-id into a php variable and not HTML so that I can run a query...
Here is the PHP file I have
<?php
$id = ( this is where the data-id needs to be );
$sql = oci_parse($conn, select * from movies m where id=:id");
oci_bind_by_name($sql, ':id', $id);
oci_execute($sql, OCI_DEFAULT);
$objResult = oci_fetch_array($sql);
?>