<i id='H1SyK'><tr id='H1SyK'><dt id='H1SyK'><q id='H1SyK'><span id='H1SyK'><b id='H1SyK'><form id='H1SyK'><ins id='H1SyK'></ins><ul id='H1SyK'></ul><sub id='H1SyK'></sub></form><legend id='H1SyK'></legend><bdo id='H1SyK'><pre id='H1SyK'><center id='H1SyK'></center></pre></bdo></b><th id='H1SyK'></th></span></q></dt></tr></i><div id='H1SyK'><tfoot id='H1SyK'></tfoot><dl id='H1SyK'><fieldset id='H1SyK'></fieldset></dl></div>

        <bdo id='H1SyK'></bdo><ul id='H1SyK'></ul>
    1. <tfoot id='H1SyK'></tfoot>
    2. <small id='H1SyK'></small><noframes id='H1SyK'>

    3. <legend id='H1SyK'><style id='H1SyK'><dir id='H1SyK'><q id='H1SyK'></q></dir></style></legend>

      1. php下拉菜单填充

        时间:2023-10-03

          <small id='VnWK9'></small><noframes id='VnWK9'>

          <tfoot id='VnWK9'></tfoot>
        1. <i id='VnWK9'><tr id='VnWK9'><dt id='VnWK9'><q id='VnWK9'><span id='VnWK9'><b id='VnWK9'><form id='VnWK9'><ins id='VnWK9'></ins><ul id='VnWK9'></ul><sub id='VnWK9'></sub></form><legend id='VnWK9'></legend><bdo id='VnWK9'><pre id='VnWK9'><center id='VnWK9'></center></pre></bdo></b><th id='VnWK9'></th></span></q></dt></tr></i><div id='VnWK9'><tfoot id='VnWK9'></tfoot><dl id='VnWK9'><fieldset id='VnWK9'></fieldset></dl></div>

            <tbody id='VnWK9'></tbody>
              • <bdo id='VnWK9'></bdo><ul id='VnWK9'></ul>
              • <legend id='VnWK9'><style id='VnWK9'><dir id='VnWK9'><q id='VnWK9'></q></dir></style></legend>

                1. 本文介绍了php下拉菜单填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试编写一个 php 脚本,该脚本将根据主下拉菜单的选择来填充第二个下拉菜单.我想用 jquery 来做所有非页面刷新的事情.但是我发现存在的每一件事都很难理解和修改,你知道任何写得很好且易于理解的东西,或者可能存在的教程吗?

                  I'm trying to write a php script that will populate a second drop down menu based on the selection of the a primary drop down menu. I would like to use jquery to do all the non-page refresh stuff. but every thing that I find that exists out there is hard to understand and modify, do you know of anything that was well written and easy to understand or maybe a tutorial that exists out there?

                  推荐答案

                  以下是一些代码,可以让您了解您想要做什么:

                  Here's some code that should give you an idea of what you want to do:

                  HTML

                  <select id="state" name="state">
                      <option value="IL">Illinois</option>
                      <option value="IN">Indiana</option>
                  </select>
                  <select id="city" name="city">
                      <option value="">Please select a state...</option>
                  </select>
                  

                  PHP

                  <?php
                      $cities = array(
                          'IL' => array( 'Chicago', 'Naperville', 'Decatur', 'Saint Charles' ),
                          'IN' => array( 'Gary', 'Miller', 'Portage', 'Merrillville' )
                      );
                  
                      print json_encode( $cities[ $_POST[ 'state' ] ] );
                      exit;
                  ?>
                  

                  jQuery

                  jQuery(document).ready(function() {
                  
                      jQuery('#state').change(function() {
                          jQuery.post(
                              'some-url.php',
                              {
                                  'state':jQuery('#state').val()
                              },
                              function(data, textStatus) {
                                  jQuery.each(data, function(index, value) {
                                      jQuery('#city').append('<option value="' + value + '">' + value + '</option>');
                                  });
                              },
                              'json'
                          );
                      });
                  
                  });
                  

                  这篇关于php下拉菜单填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:symfony2 - 从数据库中添加选择 下一篇:codeigniter - 依赖于 jquery 和 ajax post 的下拉列表

                  相关文章

                  最新文章

                2. <i id='4tLXR'><tr id='4tLXR'><dt id='4tLXR'><q id='4tLXR'><span id='4tLXR'><b id='4tLXR'><form id='4tLXR'><ins id='4tLXR'></ins><ul id='4tLXR'></ul><sub id='4tLXR'></sub></form><legend id='4tLXR'></legend><bdo id='4tLXR'><pre id='4tLXR'><center id='4tLXR'></center></pre></bdo></b><th id='4tLXR'></th></span></q></dt></tr></i><div id='4tLXR'><tfoot id='4tLXR'></tfoot><dl id='4tLXR'><fieldset id='4tLXR'></fieldset></dl></div>
                3. <legend id='4tLXR'><style id='4tLXR'><dir id='4tLXR'><q id='4tLXR'></q></dir></style></legend>

                      <small id='4tLXR'></small><noframes id='4tLXR'>

                      • <bdo id='4tLXR'></bdo><ul id='4tLXR'></ul>
                      <tfoot id='4tLXR'></tfoot>