javascript - How to use a submit button linked to a drop down list? -


i got dropdown select option , wanted able select 1 , click on submit button , lead me page (newyork.html,toronto.html,newjersey.html)

<form action="action_page.php">     <select>         <option value = "0">select destination..</option>         <option value="1">new york</option>         <option value="2">toronto</option>         <option value="3">new jersey</option>     </select>     <input type="submit" value="submit" class="mybutton"> </form> 

in actionpage have redirect user other page.

but have check security , not redirect don't know.
can use associative array form values $array = [1 => "newyork", 2 => "toronto"...] , proceed redirection without forgetting exit :

$redirect = $array[$_post['value']] + ".html"; header("location: /$redirect"); exit(); 

Comments