如何根据 `<option>` 更改 link 表单操作 a?

how change the link form action a accordance with the `<option>`?

此表单为搜索表单。当我单击 <option> "alfamart" 或 "bca" 时,我想要 link 更改。 像这样,link: /en2/maps(alfamart)or(bca)/ 按照 <option>
但是如何?

谢谢

<form action="/en2/maps".$id."/"><!--Relative url to the page that your map is on-->

    Distination: 
    <select name="textSearchTerms" class="selectpicker" data-live-search="true">
        <option value="alfamart">Alfamart</option>
     <option value="BCA">BCA</option>
    </select> 
    <input type="submit" value="Search">
</form>

<?php
$id = $_GET['textSearchTerms'];
?>

您不需要从 URL 中获取值,您可以通过 select 框值更改表单操作。

$('.selectpicker').change(function(){
if($(this).val() == 'alfamart'){
 $('form').attr('action','alfamart.html');
  alert('action is alfamart.html');
} else {
 $('form').attr('action','BCA.html');
  alert('action is BCA.html');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action="/en2/maps">

    Distination: 
    <select name="textSearchTerms" class="selectpicker" data-live-search="true">
        <option value="alfamart">Alfamart</option>
       <option value="BCA">BCA</option>
    </select> 
    <input type="submit" value="Search">
</form>