Dynamically changing of options of a list box based on period buttonIn the pervious tutorial we have seen how to populate a drop down list box by taking value from a MySQL table. Here we will manage or restrict the options of the same list box linking it to a period button. If period button is not selected then all the records of the table will populate the list box and once a selection is given to the period button then records satisfying to the value of the period button will be returned. We will be using OnClick event of the period button to reload or refresh the page with value of the period button in the query sting. Then we will read the value from the query string and then populate the list box accordingly. If the global variable is kept off in your PHP.ini settings then you have to use $_POST[variable] to get the variable for further processing.
This tutorial is similar to double drop down list box tutorial where second list box value is dynamically populated based on the selection value of the first list box.
We will receive the value and use them in our SQL query by adding one WHERE clause to restrict the records returned from the table. Here is how the value is received from query string and used for SQL query.