Results 1 to 5 of 5

Thread: Break record up and show page titles in drop box (php)

  1. #1
    Flak Monkey! Dorza's Avatar
    Join Date
    Jul 2003
    Location
    UK - South Wales
    Posts
    1,762
    Thanks
    34
    Thanked
    17 times in 15 posts
    • Dorza's system
      • Motherboard:
      • Asus P5B Deluxe - WiFi
      • CPU:
      • Q6600 @ 3.06Ghz
      • Memory:
      • 2GB Crucial
      • Storage:
      • 500GB Samsung SpinPoint
      • Graphics card(s):
      • Geforce 9600GT
      • PSU:
      • Cosair HX520W
      • Case:
      • LianLi something something or other
      • Monitor(s):
      • Eizo FlexScan S1910 (1280*1024)
      • Internet:
      • 2mb Virgin (when they want to give me that: else 1mb)

    Break record up and show page titles in drop box (php)

    A demo is appropriate: here

    See where the article page titles appear in the dropdown box? Well how do I do that is my basic question?

    Right now thats all I have with my system is the standard "Prev 1,2,3,... Next" links displayed at the bottom of an article. It works as intended however, instead of the "1,2,3..." part I would like the script to populate a form drop down box with the titles of the article page; which will make navigating through the article easier.
    Last edited by Dorza; 20-10-2007 at 03:08 PM.

  2. #2
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: Break record up and show page titles in drop box (php)

    Err, it's called a select box?

    You provided an example, what prevents you from disseminating what needs to be done from that?

    Code:
    <select name="page" onchange="pageJump(this)">
    										<option value="">Page Jump:</option>
    										<option value=""> ========== </option><option value="?item=10133&amp;page=1"  selected>Introduction</option><option value="?item=10133&amp;page=2" >Layout and features</option><option value="?item=10133&amp;page=3" >Bundle and warranty</option><option value="?item=10133&amp;page=4" >BIOS</option><option value="?item=10133&amp;page=5" >System setup and notes</option><option value="?item=10133&amp;page=6" >Memory tests and HEXUS.PiFast</option><option value="?item=10133&amp;page=7" >Multithreaded performance</option><option value="?item=10133&amp;page=8" >Storage evaluation</option><option value="?item=10133&amp;page=9" >Gaming tests and overclocking</option><option value="?item=10133&amp;page=10" >Final thoughts, HEXUS awards, HEXUS where2buy, HEXUS.right2reply, further reading</option></select>
    Code:
    function pageJump()
    {
    	location.href = arguments[0].value
    }
    To err is human. To really foul things up ... you need a computer.

  3. #3
    Flak Monkey! Dorza's Avatar
    Join Date
    Jul 2003
    Location
    UK - South Wales
    Posts
    1,762
    Thanks
    34
    Thanked
    17 times in 15 posts
    • Dorza's system
      • Motherboard:
      • Asus P5B Deluxe - WiFi
      • CPU:
      • Q6600 @ 3.06Ghz
      • Memory:
      • 2GB Crucial
      • Storage:
      • 500GB Samsung SpinPoint
      • Graphics card(s):
      • Geforce 9600GT
      • PSU:
      • Cosair HX520W
      • Case:
      • LianLi something something or other
      • Monitor(s):
      • Eizo FlexScan S1910 (1280*1024)
      • Internet:
      • 2mb Virgin (when they want to give me that: else 1mb)

    Re: Break record up and show page titles in drop box (php)

    Thanks for your suggestion, however, what happens if the user turns JS off? The feature is useless. I'd rather PHP handle it if possible.

  4. #4
    www.dougmcdonald.co.uk
    Join Date
    May 2007
    Location
    Bath
    Posts
    523
    Thanks
    5
    Thanked
    20 times in 20 posts
    • DougMcDonald's system
      • Motherboard:
      • Asus P5B Deluxe
      • CPU:
      • Inter Core 2 Duo E6600
      • Memory:
      • 2 x 2GB - Geil Black Dragon PC6400
      • Storage:
      • 2 x 400GB Samsung Spinpoints (Running in Matrix array) 100GB @ RAID0 + 300GB @ RAID1
      • Graphics card(s):
      • BFG nVidia 8800GTS 320MB OC2
      • PSU:
      • Corsair HX520W modular
      • Case:
      • Lian-Li PC7 II Plus
      • Monitor(s):
      • LG 17" Flat Thingy
      • Internet:
      • Crappy BT 1MB Unreliable wank :s

    Re: Break record up and show page titles in drop box (php)

    The concept would be that you would get the dataset which would include your article titles, loop through it displaying an <option> $article_name_variable </option> type thing for each row, and then just use a submit button to do the moving between pages.

    Pseudo Code:
    <form>
    <select>
    <?php
    for (number of rows in dataset) {
    print (<option>$article_name</option>)
    }
    ?>
    </select>
    <input type=submit>go</input>
    </form>

    That type of thing will build the dropdown box as you want. (Will need some error checking added etc)

    Then just make your submit button fire at a page which will have checks to see what variable has been selected from your drop down and display the appropriate content.

  5. #5
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: Break record up and show page titles in drop box (php)

    PHP is a server-side scripting language. You can't handle dom events like in the example provided with it. You would have to use it like a 'normal' form as suggested above.
    To err is human. To really foul things up ... you need a computer.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •