Jump to content

Recommended Posts

I would like this code to auto link after it is selected, that means when u choose an option in the dropdown it links you without having to click any buttons. It is for a pagination for the limit of how many to show on each page.

 

  <font color="black">Show per page</font>
    <select onchange="setLocation(this.value)">
            <option value="?limit=9">9</option>
            <option value="?limit=15">15</option>
            <option value="?limit=30">30</option>
            <option value="?limit=all">
            All        </option>
        </select> 

 

Link to comment
https://forums.phpfreaks.com/topic/180719-dropdown-link/
Share on other sites

Basically this:

 

<script language="JavaScript">
function loadPage(list) {
  location.href=list.options[list.selectedIndex].value
}
</script>


<form>
<select name="file" size="1"
  onchange="loadPage(this.form.elements[0])" target="_parent._top"
            <option value="?limit=9">9</option>
            <option value="?limit=15">15</option>
            <option value="?limit=30">30</option>
            <option value="?limit=all">All</option>
</select>
</form>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/180719-dropdown-link/#findComment-953622
Share on other sites

I think this is what you are looking for but you still didnt explain it any better you just said basically this with an example that still doesnt explain what you are trying to do. I assume you are trying to submit the page on change and pass the limit to the page so try this:

 

<form>
<select name="limit" size="1" onchange="this.form.submit();">
            <option value="9">9</option>
            <option value="15">15</option>
            <option value="30">30</option>
            <option value="all">All</option>
</select>
</form>

 

So basically that will submit this form and it will put a get variable in the url. so in this case the url will look like http://yourwebsite.com?limit=9 if you were to select the first option. is that what you were looking for?

Link to comment
https://forums.phpfreaks.com/topic/180719-dropdown-link/#findComment-953922
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.