[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

Grabbing a value from the form control


I have control (jump menu) on my page.  I wouold like for a user to select a value from the list and then be able to click a link next to it with the selected value in the link itself.

Here is the link I have:

af_site.php?type=rm&rm_name='control value'

the control name is jmp_rm

Many Thanks.
  • 2
1 Solution
OK, give the select list an ID, call it the same as the name 'jmp_rm'.

Then put this in the <HEAD> of your web site:

<script language="javascript">

getURL(id) {
  window.location = 'af_site.php?type=rm&rm_name=' + document.getElementById(id).value;


The link next to the box will be like this:
<a href="javascript:getURL('jmp_rm');">Follow link</a>
Hi, you need javascript to do this.
Try the code below :)
<select name="jmp_rm" onchange="document.getElementById('Link').href = 'af_site.php?type=rm&rm_name=' + escape(this.value);">
<option>Please select ...</option>
<option value="value1">option 1</option>
<option value="value2">option 2</option>
<a href="#" id="Link">Go</a>

Open in new window

andyw27Author Commented:
Perfect, exactly what I'm looking for - thanks
andyw27Author Commented:
Can this be expanded abit.  I need to capture the same value but send it to a different page.  To do this I would like another link.  I've tried to alter the existing code however the first URL is coded into the onlick event of the control.  I've tried adding a second onchange event however that did not work?

Any suggestions?

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now