/    Sign up×
Community /Pin to ProfileBookmark

Help with variabled jump menu – which concatinates values of each field into a URL?

I am building an HTML form

It has 3 select fields called:

State
County
OfficeType

I want to build a string for the url to which to navigate from the 3 selected values on the form

Here’s an example:

Let’s say we select the following values for each
PA
Bucks
Dentist

I want to click on a submit button that will send me to
http://www.somesite.com/somedirectory/PABucksDentist.html

Basically this is a 3 variabled jump menu – which concatinates the string values of each selection field into a URL

any ideas would be greatly appreciated.

Regards,

John Kolker

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJul 04.2005 — <i>
</i>var sel, url = "http://www.somesite.com/somedirectory/";
sel = document.forms[0].StateSelect;
url += sel.options[sel.selectedIndex].value;
sel = document.forms[0].CountySelect;
url += sel.options[sel.selectedIndex].value;
sel = document.forms[0].OfficeTypeSelect;
url += sel.options[sel.selectedIndex].value;
top.location.href = url + ".html";
×

Success!

Help @jwkolker spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...