Try this for your creation of the hidden variable

print hidden(
-name => last_message_num, 
-default => $message_num, 
# -override=> 1
);

If last_message_num is already defined in your CGI object, you'll have
to use the override option like you have it here, just uncomment it.
This one screwed me up all the time too - it's -name and -default, not
-name and -value.  At least, that's how it shows in my CGI.pm
documentation.

====================
Brian Arnold
[EMAIL PROTECTED]

-----Original Message-----
From: David Gilden [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 17, 2001 12:56 PM
To: [EMAIL PROTECTED]
Subject: CGI.pm hidden field problem 


Hello,

I am taking a stab at a SQL driven guest-book, 
the problem is with getting the <hidden> field to take the value of
$message_num, (see the end of this script) I can see it in the <!--
print statement --> ok, 
but not in the hidden field (I have tried with override and with out --
not sure what this is for!) I welcome any suggestions on clearing up
this problem so that I can move on to the next problem :)

Thanks
Dave
-----------------------


#!/usr/bin/perl -w

# SQL Guestbook

use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
require "dbi-lib.pl";

my
(%sort_direction,$offset,$message_num,$last_message_num,$sort_direction,
$name, $email,$date,$message);


$sort_direction = param('sort_direction') || 0; # Sort Direction for
numbers

# set up $message_num  to count up or down
$message_num  = (!$sort_direction) ? 0 : 11;

$table_name = "sqlguestbook";

&initialize_dbi;
&whichButton;


&run_statement(&sql_statement);

print header,
      start_html( -title => 'Dave\'s Guestbook' );


print  start_form( -method => 'POST' ),
       "\n<p>", submit( -name=> 'action', -value => 'Sort Messages' ), "
&nbsp;&nbsp; ";
    
    
    %sort_direction =(
    0 => 'First to Last ',
    1 => 'Last to First ',
 );

print   radio_group(
        -name    => 'sort_direction',
        -values  => [ keys %sort_direction ],
        -default => $sort_direction,
        -labels  => \%sort_direction
       ),

"</p>\n";

     
print h2('Dave\'s Guest Book');


print submit( -name => 'action',  -value => 'Previous 10 Entries' ) ;#
unless $beginning; print '&nbsp;&nbsp;'; # space out the buttons print
submit( -name => 'action',  -value => 'Next 10 Entries' ); #unless
$last_message_num <= 10;


# Start Table Data
print <<TABLEHEADER;
<table border="1" cellspacing="2" cellpadding="2" width="98%"> <tr> <th
style="color:red;">Message
Number</th><th>Name</th><th>Date</th><th>Email</th><th>Message</th>
</tr>
TABLEHEADER

$message_num  += $last_message_num; # make sure the messages numbers are
correct

while (($name,$date,$email,$message) = $sth->fetchrow) {
(!$sort_direction) ? $message_num ++ : $message_num --;
print "<tr>\n<td>$message_num </td>";
print <<TD;
<td>$name</td>
<td>$date</td>
<td>$email</td>
<td>$message</td>
</tr>\n
TD
}  


# End Table Rows
print "</table>\n";
$message_num  = 
print "<!-- $message_num  -->\n";
print hidden(
-name => last_message_num, 
-value => $message_num, 
# -override=> 1
);

*====================================================*
*   Cora Connection Your West African Music Source   *  
*   http://www.coraconnection.com/                   *  
*   Resources, Recordings, Instruments & More!       *
*====================================================*

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to