Grabbing a value from the form control

Hello,

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.
andyw27Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PhatzerCommented:
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;
}

//-->
</script>

The link next to the box will be like this:
<a href="javascript:getURL('jmp_rm');">Follow link</a>
0
BenMorelCommented:
Hi, you need javascript to do this.
Try the code below :)
Regards,
Ben
<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>
</select>
<a href="#" id="Link">Go</a>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andyw27Author Commented:
Perfect, exactly what I'm looking for - thanks
0
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?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.