• <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 代码

        PHP code to get selected text of a combo box(用于获取组合框的选定文本的 PHP 代码)

            <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 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                  How to parse django style template tags(如何解析 django 样式模板标签)
                  What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                  How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                  What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                  php in background exec() function(php 后台 exec() 函数)
                1. <tfoot id='b7j5P'></tfoot>
                  • <bdo id='b7j5P'></bdo><ul id='b7j5P'></ul>

                      <tbody id='b7j5P'></tbody>
                    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'>

                      • <legend id='b7j5P'><style id='b7j5P'><dir id='b7j5P'><q id='b7j5P'></q></dir></style></legend>