如何使用链接填充表单下拉列表 [英] How to populate form dropdown by using a link

查看:98
本文介绍了如何使用链接填充表单下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,

所以我一直在尽我所能来解决这个问题,但我完全陷入困境。我有一个表格供用户填写。我也有链接遍布我的网站,将他们带到这种形式。我想根据它们的来源填充该表单中的一个下拉列表。我的下拉列表名为id =show_customer3。



Hey Guys,
So I've been trying my best to figure this out on my own, but I'm completely stuck. I have a form for users to fill out. I also have links spread throughout my site that takes them to this form. I want to populate one of the dropdowns in that form based on where they came from. My dropdown is called id="show_customer3".

    <div id="show_demo2" >
      <p>Where did you hear about us?:</p>
    </div>
<!--This is where the user selects which product they own.-->
  <td colspan="1" rowspan="1">
    <div id="show_customer3" style="display: none;">
      <p><select id="WHAT" name="WHAT" size="1">
        <option selected="selected" value="">Select One</option>
        <option value="Item 1">Item 1</option>
        <option value="Item 2">Item 2</option>
        <option value="Item 3">Item 3</option>
        <option value="Item 4">Item 4</option>
        <option value="Item 5">Item 5</option>
        <option value="Item 6">Item 6</option>
        <option value="Item 7">Item 8</option>
        <option value="Item 9">Item 9</option>
        <option value="Item 10">Item 10</option>
        <option value="Item 11">Item 11</option>
        <option value="Item 12">Item 12</option>
      </select></p>
    </div>

    <div id="show_demo3" style="display: none;">
      <p>
        <input maxlength="64" name="WHERE" size="30" type="text" value="" />
      </p>
    </div>
  </td>





我以为我的链接看起来像是:



I was thinking my link would look something like:

mysite.com/thispage#show_customer3;selected="Item 1"





我感谢任何帮助。谢谢!



I appreciate any help. Thanks!

推荐答案

因此,在其他页面上的链接中添加一个参数,表示它们来自哪个页面。该参数必须通过此页面中的代码获取,以告知用户来自何处。



另一种方法是查看HTML请求属性对于REFERER项目。这将是用户刚来的页面。
So add a parameter to the link on the other pages that denotes which page they came from. The parameter will have to get picked up by the code in this page to tell it where the user came from.

An alternate method is to look in the HTML request properties for the REFERER item. That will be the page the user just came from.


这篇关于如何使用链接填充表单下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆