waggz has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to add a next and previous button to an image galley. Now because the images change almost daily, I dont think I can use an array. Some one has given me a way of trying to do it but I dont know if it was written right because the button doesnt advance to the next photo. Here is the address of the page im working on:
http://www.timmillerphotography.com/cgi-bin/wedding_view.pl?id=20122&m +ore=Becky_and_Jason&value=Before_the_Ceremony&place=1&select=1
Just click on the thumbanil to see what Im talking about. If you need the code to see what Im talking about just email me and ill give it to you. Thnak you, Joe

2004-12-05 Janitored by Arunbear - added code tags around (long) url

Replies are listed 'Best First'.
Re: next and previous buttons
by tachyon (Chancellor) on Dec 05, 2004 at 00:03 UTC

    You have this:

    <!-- Next Photo Button Form --> "<button onclick="window.navigate'"; "http://www.timmillerphotography.com/cgi-bin/wedding_view_photo.pl?id= +20122&more=Becky_and_Jason&name=Before_the_Ceremony&value="; ["+1"]; "&goback=&select='; "">Next</button> <!-- Next Photo Button Form --> + <!-- Back Button Form --> <form action="http://www.timmillerphotography.com/cgi-bin/wedding_view +.pl" method="POST"> <input type="hidden" name="class" value=Before_the_Ceremony> <input type="hidden" name="value" value=Before_the_Ceremony> <input type="hidden" name="place" value=1> <input type="hidden" name="student" value=C173B200.jpg> <input type="hidden" name="select" value=> <input type="hidden" name="id" value=20122> <input type="hidden" name="more" value=Becky_and_Jason> <input type="hidden" name="recipientnum" value="+1"> <input type="submit" value="BACK" name="back"> </form> <!-- Back Button Form -->

    The top section is gibberish. You are trying to use javascript to call a Perl CGI but don't seem to have much of a clue about what is and is not valid HTML/javascript syntax.

    The OUTPUT that is generated by the Perl CGI needs to change to be:

    <button onclick="window.navigate('http://www.timmillerphotography.com/ +cgi-bin/wedding_view_photo.pl?id=20122&more=Becky_and_Jason&name=Befo +re_the_Ceremony&goback=&select=&value=+1')">Next</button>

    This needs to be generated in your Perl code. BUT it does not work as is because the CGI does not understand the concept of a value +1. It wants something C173B202.jpg as a value where this value is the name of the next picture to display.

    You need to post some of the Perl code if you want more useful help. When your code displays an image it needs to get the name of the next image. This will be at index +1 if the names are in an array which is probably what your +1 represents. You then need to output HTML that looks like the example above with the +1 fixed.

    cheers

    tachyon

Re: next and previous buttons
by Cody Pendant (Prior) on Dec 05, 2004 at 02:09 UTC
    because the images change almost daily, I dont think I can use an array

    I think I speak for all of us when I say I'd like you to explain what you meant by that!



    ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
    =~y~b-v~a-z~s; print