/    Sign up×
Community /Pin to ProfileBookmark

Changing the HTML page depending on dropdown selection

Hi all.

I am struggling to find the correct post to help me.

I have a simple search feature on my website, two dropdowns (Category and Location) and the search button.
I want to have the City dropdown required.

Here is a breakdown;

[code=html]<select class=”form-control” title=”” id=”category”>
<option value=””>All</option>
<option value=”-bed-breakfast”>Bed &amp; Breakfast</option>
<option value=”-self-catering”>Self-Catering Guesthouse</option>
<option value=”-backpackers”>Backpackers</option>
<option value=”-hotel”>Hotel</option>
</select>[/code]

[code=html]<select class=”form-control” title=”Location” id=”location” required>
<option value=”-city1″>City 1 Name</option>
<option value=”-city2″>City 2 Name</option>
<option value=”-city3″>City 3 Name</option>
<option value=”-city4″>City 4 Name</option>
</select>[/code]

When the Search / Submit button is clicked, I need the form to perform an action along the lines of merging the two options selected.
There needs to be a preloaded “accommodation” already, so for example, if the user selects (Hotel) and (City 1 Name), the button needs to send the user to the following page: [B]accommodation-hotel-city1.html[/B]

The Category selection can also be left blank/unselected, but the Location needs to be required, so a result can be: [B]accommodation-city1.html[/B]

Is there a simple way of getting this done?

Thanks.

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@cootheadMay 12.2017 — Hi there Kaldera,

[indent]

this needs to be done server side. ?

Check out the attachment, which includes a simple PHP example.

[/indent]

[i]coothead[/i]

[canned-message]attachments-removed-during-migration[/canned-message]
×

Success!

Help @Kaldera 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.28,
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,
)...