So my exact problem is, I have a select form. There are 4 options in there, with values 1, 2, 3, and 4. There's a button form next to the select. Whenever I click on the button, it should navigate me to the select form's selected option's location (for example index.php?page=1). How can I solve this problem? I've read its impossible due to the php's server sides mechanic, etc, but there must be a way.. So far I've got an onclick event for the button, like...: location.href='index.php?page=.. and whats going in there ..
it will work
<select id="some_id">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<button type="button" onclick="window.location.href='index.php?page='+document.getElementById('some_id').value;">Go</button>
A normal GET form should work.
<form action="index.php" method="get">
<select name="page">
<option value="1">Page Name</option>
...
</select>
<input type="submit" value="Submit">
</form>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.