passing select value to php variable
I am at an impass.
I want to pass the value of the selected drop down menu selected option. To a php variable that will be used in a MySQL statement, which in turn will alter a second drop down menu. Here is what happens. When I make my selection from the first drop down menu nothing changes on the second drop down menu. After I clicked the submit button then the change takes place. What do I need to do to make the change take place with out having to click the submit button? Thanks for any help, since I am stuck.
- <script type="text/javascript">
$(document).ready(
function(){
$('#selFaxType').click(function() {
//var selFaxTypeID = $('#selFaxType option:selected').val();
var selFaxTypeID = $('#selFaxType').val();
$("input[name=selFTID]").val(selFaxTypeID);
$.post("fax_details.php", {selFTID: selFaxTypeID}, function(data){});
});
$('.datepicker').datepicker();
}
);
</script>
- //Get value from POST
<?
$selFTID = CleanNumber($_POST['selFTID']);
- //MySQL statement
<select name="selFaxSubType" id="selFaxSubType" size=1>
<option value=""></option>
- <?php
echo "selFTID: $selFTID <br />";
$strSQL = 'SELECT fax_sub_type_id, fax_sub_type FROM fax_sub_types WHERE fax_type_id ="'. $selFTID . '" AND fax_sub_type_disable=0 ORDER by fax_sub_type';
- //Store value in a hidden field
<input name="selFTID" id="selFTID" type="hidden" value="<?=$selFTID?>" />