Append variable to end of URL via select

Hi there,

I have a form which I would like to append a variable to the end of the URL after it is submitted.

To do this, I would like to use a select drop down:

<select id="ddl" name="term">
        <option selected="selected" value="all">Please Select...</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
      </select>

The variable I would like to add to the end of the URL would be: &option=1, &option=2 etc depending on the selected item.

How would I go about doing this?

Thanks!

Will the list of options be static, or will they change over time at all? It ‘may’ make a difference as to where the URL will need to be pointed. It might be worth outlining a bit more about what the menu options will be, so we can understand the use case a little better.

Hi,

The options will be static. They will basically be used to filter results on a search form based on which option is selected.

So why have you given the field name=“term” instead of name=“option”? The way you currently have it the form will use &term=1 &term=2 etc instead of option.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.