I want a select tag , choose an option , click submit , and go to a certain link . i found some solutions in here but wasn't what i was looking for , for example , some used onchange on select tag but it goes to the link before clicking the button , i look for a solution with php or javascript (no jquery) . this is what i tried , i don't know if it's correct or not . Please help, Thank you.
<form>
<select class="custom-select" id="select" >
<option selected>Choose...</option>
<option value="page1.php">1</option>
<option value="page2.php">2</option>
<option value="page3.php">3</option>
<option value="page4.php">4</option>
</select><br>
<input class=" rech btn btn-outline-success btn-lg" type="submit" value="RECHERCHER" onClick="location=document.getElementById('select').value;"><br>
</form>
Aucun commentaire:
Enregistrer un commentaire