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

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

      1. <tfoot id='roIwS'></tfoot>

        PHP 获取下拉列表选择选项值

        时间:2023-10-03

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

                • <small id='UrJQt'></small><noframes id='UrJQt'>

                • 本文介绍了PHP 获取下拉列表选择选项值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在我的下拉列表中,每个选项都有两个不同的值.我怎样才能检索两者?让我来说明一下我的意思.

                  In my dropdownlist I have two different values for each option. How can I retrieve both? Let me illustrate what I mean.

                  <select name="my_ddl">
                    <option value="<?php $value_Id ?>"><?php $value_text ?></option>
                    <option value="<?php $value_Id ?>"><?php $value_text ?></option>
                  </select>
                  

                  当表单发布时,我希望能够同时获取所选选项的 $value_id 和 $value_text.我该怎么做?

                  When the form is posted, I want to be able to get both the $value_id and $value_text of the selected option. How can I do this?

                  $_POST['my_ddl'] 只能得到一个值,不能同时得到两个值.

                  $_POST['my_ddl'] only gets one value not both.

                  在 asp.net 中,我可以通过引用 my_ddl.Value 和 my_ddl.Text 来做到这一点.

                  In asp.net I could do this simply by referring to my_ddl.Value and my_ddl.Text.

                  谢谢!

                  推荐答案

                  严格来说,这是不可能的.

                  Strictly, this is not possible.

                  可以做的是在你的value属性中使用一个分隔符:

                  What you could do is use a delimiter in your value attribute:

                  <select name="my_ddl">
                    <option value="<?php echo $value_Id ?>|<?php echo $value_text ?>"><?php echo $value_text ?>   
                    </option>
                  </select>
                  

                  还有……

                  <?php    
                     list($id, $text) = explode('|', $_POST['my_ddl']);
                     //...
                  ?>
                  

                  这篇关于PHP 获取下拉列表选择选项值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:<选择>下拉默认值 下一篇:在 Zend Framework 2 中创建下拉列表

                  相关文章

                  最新文章

                  <small id='8FVjd'></small><noframes id='8FVjd'>

                    <bdo id='8FVjd'></bdo><ul id='8FVjd'></ul>

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