Jump to content

PHP Paging with DropDown box.


jaydee

Recommended Posts

I'm coding a forum, it's all mostly done I'm just sorting the paging. Now, I know how to create page links etc and do all that, but I want them to appear in a dropdown box, not just links. Again, I know how to make it so when they select from the dropdown it will redirect to the relevant page it's just getting the amount of pages into the dropdown. The basic code is :(pcounter is the max amount of pages, worked out earlier in the script by dividing amount of forum posts by 10. )

 

$i=1;
for($i = 1; $i <= $pcounter; ++$i) {

<select name='NavSelect' onChange='Navigate(this.form)'>";
<option value='$i'>Page $i of $pcounter
</select>

 

That works sort of, it displays all of the pages but all in different dropdowns, so theres 4 pages, 1st dropdown Page 1 of 4, 2nd dropdown Page 2 of 4 etc I want them all in one dropdown, I've tried alsorts like starting the select box before the for() loop starts but that causes more problems!!

 

Any suggestions?

 

Link to comment
https://forums.phpfreaks.com/topic/191081-php-paging-with-dropdown-box/
Share on other sites

I tried print before, using same as what you've just posted and it failed, because of a bonehead mistake! I put the </select> in the loop, so it'd only do the first page then the rest showed up as just text so pretty stupid of me, that works perfect, thanks a lot, amazingly quick response too! :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.