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

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

        用于获取组合框的选定文本的 PHP 代码

        时间:2023-08-20

            <bdo id='ybj0I'></bdo><ul id='ybj0I'></ul>

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

                  本文介绍了用于获取组合框的选定文本的 PHP 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个名为Make"的组合框.在那个组合框中,我正在加载车辆制造商的名称.当我单击搜索"按钮时,我想显示选定的制造商名称.下面是我的 HTML 代码的一部分.

                  I have a combo box named "Make". In that combo box I'm loading vehicle manufacturer names. When I click SEARCH button I want to display the selected manufacturer name. Below is part of my HTML code.

                  <label for="Manufacturer"> Manufacturer : </label>
                  <select id="cmbMake" name="Make" >
                     <option value="0">Select Manufacturer</option>
                     <option value="1">--Any--</option>
                     <option value="2">Toyota</option>
                     <option value="3">Nissan</option>
                  </select>
                  
                  <input type="submit" name="search" value="Search"/>
                  

                  以下是到目前为止我已经完成的 PHP 代码.

                  Below is my PHP code so far I've done.

                   <?php
                  
                  if(isset($_POST['search']))
                  {
                      $maker = mysql_real_escape_string($_POST['Make']);
                      echo $maker;
                      }
                   ?>
                  

                  如果我从组合框中选择 Toyota 并按 SEARCH 按钮,我得到的答案为 '2' .这意味着它给了我丰田"的价值.但我想显示丰田"这个名字.我怎样才能做到这一点?请帮帮我....

                  If I select Toyota from the combo box and press SEARCH button, I'm getting the answer as '2' . It means it gives me the value of the 'Toyota'. But I want to display the name 'Toyota'. How can I do that? Please help me ....

                  推荐答案

                  试试这个.您将在 $_POST['Make'] 中获得选择框值,名称将在 $_POST['selected_text'] 中获得

                  Try with this. You will get the select box value in $_POST['Make'] and name will get in $_POST['selected_text']

                  <form method="POST" >
                  <label for="Manufacturer"> Manufacturer : </label>
                    <select id="cmbMake" name="Make"     onchange="document.getElementById('selected_text').value=this.options[this.selectedIndex].text">
                       <option value="0">Select Manufacturer</option>
                       <option value="1">--Any--</option>
                       <option value="2">Toyota</option>
                       <option value="3">Nissan</option>
                  </select>
                  <input type="hidden" name="selected_text" id="selected_text" value="" />
                  <input type="submit" name="search" value="Search"/>
                  </form>
                  
                  
                   <?php
                  
                  if(isset($_POST['search']))
                  {
                  
                      $makerValue = $_POST['Make']; // make value
                  
                      $maker = mysql_real_escape_string($_POST['selected_text']); // get the selected text
                      echo $maker;
                  }
                   ?>
                  

                  这篇关于用于获取组合框的选定文本的 PHP 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PHP 闭包中的 use 关键字是否通过引用传递? 下一篇:文件下载的 HTTP 标头

                  相关文章

                1. <tfoot id='b7j5P'></tfoot>
                  • <bdo id='b7j5P'></bdo><ul id='b7j5P'></ul>

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

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

                  2. <legend id='b7j5P'><style id='b7j5P'><dir id='b7j5P'><q id='b7j5P'></q></dir></style></legend>