Rectangle 27 0

php setting session variables into drop down menu selected item?

$("select[name='dropdownBox']").change(function() { //event handler
        newvalue = $(this).val(); //get selected value
                    type : 'GET',
                    url : 'ajax.php',
                    dataType : 'json',
                    data : {
                        p : 'updateVar',
                        v : newvalue
                    success : function(data) {
                       //on success code
                    error : function(XMLHttpRequest, textStatus, errorThrown) {
                       //on error code
 } );

As a previous comment mentioned, to "dynamically" update a session variable you'd have to use javascript (jQuery is a good library to use). If you add a event handlers to the dropdown box: onChange='updateVar();' and then create a javascript function to update the value of the variable. One way this function could work is to use ajax to call a php page which updates the session variable.

Then you just need a simple php script that grabs the $_GET variables and updates the $_SESSION variables required.