Hi,

I have a script which generates clickable file listings ( a click on
which displays the file and appends the contents of a comment file ),
so far so good.  The filename, subject directory etc are passed around
by hyperref as in

<a
href="scriptname.pl?action=display&subject=$subject&filename=$file&heading=$heading">$heading</a>

etc etc.

When I wish to add a comment the arguments are passed in by a submit
button on a form as well as in the action field, eg:

<form method="post"     
action="scriptname.pl?action=add_comment&subject=$subject&filename=$filename">
<p>Please enter your name : <input type="text" name="name"
maxlength="50"></p>  etc etc 

The params are parsed at the beginning of the script as follows and
then in theory passed to the relevant sub.  eg:

 my $subject     = ( param( 'subject'  )) || '';
 my $filename    = ( param( 'filename' )) || '';
 my $heading     = ( param( 'heading'  )) || '';
 my $name        = ( param( 'name'     )) || '';
 my $email       = ( param( 'email'    )) || '';
 my $text        = ( param( 'text'     )) || '';

 my $action      = ( param( 'action'   )) || '';
 my $title       = ( param( 'title'    )) || '';
 my $file  = '';


AND THEN:

 if    ( $action eq 'start'   )     { start(); }
 elsif ( $action eq 'list'    )     { list(); }
 elsif ( $action eq 'display' )     { display(); }
 elsif ( $action eq 'get_comment' ) { get_comment(); }
 elsif ( $action eq 'add_comment' ) { add_comment(); }
 else  { start() }

My problem is that the add_comment sub seems to receive the filename
and subject but not the items that were form fields.

add_comment begins like this:

sub add_comment {

        $subject     =  param( 'subject'  );
    $filename    =  param( 'filename' );
    $name        =  param( 'name'     );
    $email       =  param( 'email'    );
    $text        =  param( 'text'     );
        
    local *COMMENT;
    open  ( COMMENT, ">>$COMMENT_FILE" ) || die "Cannot open comment file: $!";
    flock COMMENT, LOCK_EX;
    print COMMENT ( $today, "&nbsp &nbsp &nbsp &nbsp" ,   $name, "&nbsp &nbsp :&nbsp 
&nbsp" ,  $email, "<br>", $text, "<br><br><hr>" );
    close COMMENT;

What newbie thing am I missing?

Many Thanks

Francesco

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

Reply via email to