in reply to Re: conditional submit buttons
in thread conditional submit buttons

if($firstrec <= $lastrec) { print $q->start_form(-name=>'displaynext',-method=>'POST',-action=>'ne +xt.cgi'); print "<input type=hidden name=i value='$id'>"; print "<input type=hidden name=u value='$username'>"; print $q->submit(-name=>'next',-value=>'next'); print $q->end_form(); } print $q->start_form(-name=>'display prev',-method=>'POST',-action=>'p +rev.cgi'); print "<input type=hidden name=i value='$id'>"; print "<input type=hidden name=u value='$username'>"; print $q->submit(-name=>'prev',-value=>'prev'); print $q->end_form();

the next button is the same as prev button
$firstrec is the first record in a user group
$lastrec is the last record in a user group
when I reach the $lastrec I want to stop the next button from working and when i reach $firstrec i want the prev button to stop working.

john larson

20031212 Edit by Corion: Added formatting, fixed CODE tags

Replies are listed 'Best First'.
Re: Re: Re: conditional submit buttons
by edoc (Chaplain) on Dec 12, 2003 at 02:35 UTC

    hmmm.. what is the value of the image currently being displayed? Is $id a visitor id or the current image id?

    assuming $id, $firstrec, & $lastrec are numerical codes representing current image, first image, and last image, and your image codes are sorted numerically.. maybe you're looking for something like this?

    if ( $id < $lastrec ){ print $q->start_form(-name=>'displaynext',-method=>'POST',-action=>' +next.cgi'); print "<input type=hidden name=i value='$id'>"; print "<input type=hidden name=u value='$username'>"; print $q->submit(-name=>'next',-value=>'next'); print $q->end_form(); } if ( $id > $firstrec ){ print $q->start_form(-name=>'display prev',-method=>'POST',-action=> +'prev.cgi'); print "<input type=hidden name=i value='$id'>"; print "<input type=hidden name=u value='$username'>"; print $q->submit(-name=>'prev',-value=>'prev'); print $q->end_form(); }

    cheers,

    J