I have a query here that I use 2 select boxes and here I got the value changed over 2nd select box after first select box value has been selected. The first select box is for Projects and the second one is for modules. The modules are changed as per the project is changed. So here I got the value of modules. My query is I want the value of module into a PHP variable. Here is my code,
<script src="js/jquery-1.8.3.min.js"></script>
<script>
$(document).ready(function() {
$("#state-list option").filter(function() {
return $(this).val() == $("#mm").val();
}).attr('selected', true);
$("#state-list").live("change", function() {
$("#mm").val($(this).find("option:selected").attr("value"));
var val = $("#mm").val();
alert("val===="+val);
});
});
</script>
<?php
$module_id= var val; //(if this is possible on any how then please help me out.)
$sql_host = 'localhost';
$sql_user = "root";
$sql_pass = "";
$sql_data = "abc";
// Opens a connection to a MySQL server
$connection = mysql_connect ($sql_host, $sql_user, $sql_pass);
// Set the active MySQL database
$db_selected = mysql_select_db($sql_data, $connection);
$qyrey="select * from tblamount where moduleid='$module_id'";
mysql_query($qyrey) or die('error');
?>
How I can get the value of script variable value into a PHP variable. Means "var val variable value into PHP variable $module_id
"? How this will be possible.