Creating a Drop Down Menu in PHP from MySQL?

后端 未结 2 2027
面向向阳花
面向向阳花 2021-01-23 21:30

I\'m sort of experienced with PHP and MySQL so I kind of get the hang of things, however I\'m sort of trying to get something that may be over my level (not really sure the diff

2条回答
  •  抹茶落季
    2021-01-23 21:53

    Create a div and give it a id="result" and put an empty select tag in that div.

    Then using jQuery + Ajax, get the second dropdown using:

    $('select[name="user"]').change(function(){
       var user = $(this).val();
    
       $.ajax({
          type:'post',
          url:'getSecondDropDown.php',
          data:'user='+user,
          success:function(result){
             $('div#result').html(result);
          }
       });
    
    });
    

    In your 'getSecondDropDown.php' file, include this:

    
    

提交回复
热议问题