Hi,
        I have a table where each cell represents a particular server.
        Each element in the cell has hyperlinks specified.The hyperlink
        invokes a script which generates a form and helps user to save 
        and update information. The form has a field like name
indicating
        who is using that server.It also has some other fields
        
        My problem is how do I pass the server name in the first script
(which generates
        the table) to the second script( which updates form).

        The other very stupid solution is to write separate scripts for
each element in
        the table.

        If anybody can review and provide comments for improvement that
will be great. 

Thanx,
Alok.   

--------------------------
Table code snippet :
---------------------------

print $cgi->table(
                $cgi->Tr(
                                {-align=>'center',-valign=>'middle'},
                                $cgi->td([
                                                '<A
HREF="telnet://16.180.107.10/">Cayennesw1a',
                                                '<A
HREF="https://192.10.11.11/";>bl20pG2-e1-b1</A> <BR><BR>
                                                        <small><i><A
HREF="http://15.76.97.213/scripts/status.pl";>Status</A></i></small>',
                                                '<A
HREF="https://192.10.11.12/";>bl20pG2-e2-b2</A> <BR><BR>
                                                        <small><i><A
HREF="http://15.76.97.213/scripts/status.pl";>Status</A></i></small>',
                                                'No Blade',
                                                '<A
HREF="https://192.10.11.14/";>bl20pG2-e2-b4</A>',

                                                '<A
HREF="https://192.10.11.15/";>bl20pG2-e2-b5</A>',
                                                '<A
HREF="https://192.10.11.16/";>bl20pG2-e2-b6</A>',
                                                '<A
HREF="https://192.10.11.60/";>bl25pG2-e2-b7</A>',
                                                'No Blade',
                                                '<A
HREF="telnet://16.180.107.11/">Cayennesw1b',
                                                
                                        ]),
                                $cgi->caption("Enclosure 3 ILO Links") 
                )
        ) ;
#print $cgi->b("bold") ; ;
print $cgi->br() ;

***********************************************************
Script to generate form
***********************************************************

#!/usr/bin/perl -w

use CGI qw/:standard/ ;
use Fcntl qw(:flock) ;#for file locking symbols
use strict ;

my $msgFile = "Inventory.txt" ;

my $user ;
my $fromDate ;
my $toDate ;

my $cgi = new CGI ;
print $cgi->header(-expires=>'now') ;


# Trying to read the file. If blade name = current blade display the
info and generate update form
if (open (FILE, $msgFile)) {
        flock FILE, LOCK_SH ; #Shared lock 
        my $oldCgi = new CGI(\*FILE) ;
        flock FILE, LOCK_UN ;
        close (FILE) ;  
        
        print "Debug : Inside reading file" ; print $cgi->br() ;
        
        
        if (my $oldMsg = $oldCgi->param('user')){
                print "user =", $cgi->param('user') ;
        }       
        
        #print $cgi->br() ;     
} else {
        print "Debug : Failed open reading file" ;
}


# Saving file
if (my $newMsg = $cgi->param('user')) {
        my $from_Date = $cgi->param('fromDate') ;
        my $to_Date = $cgi->param('toDate') ;
        
        print $cgi->p("The username is $newMsg") ;
        print $cgi->p("The From Date is $from_Date") ;
        print $cgi->p("The To Date is $to_Date") ;
        
        if (open (SAVE, ">> $msgFile")) {
                flock SAVE, LOCK_EX ; #Exclusive lock 
                $cgi->save (\*SAVE) ;
                flock SAVE, LOCK_UN ;
                
                close (SAVE) ;
                
                exit ;
                
        } else {
                print "Failed to save" ;                
        }       
}

print $cgi->start_html("Submit Page"),
        "<h2 align='center'>Input Form</h2>" ;
generate_form() ;       

print $cgi->end_html() ;


########################################################################
#############
##                      Subroutine to generate form 
########################################################################
#############
sub generate_form{
        print $cgi->startform(-method=>'Get') ;
        
        
        print $cgi->b(),
                "Blade", $cgi->textfield(-name=>'blade'),
                $cgi->br(),
                $cgi->br(),
                "User ", $cgi->textfield(-name=>'user'),
                $cgi->br(),
                $cgi->br(),
                "From Date ", $cgi->textfield(-name=>'fromDate'),
                $cgi->br(),
                $cgi->br(),
                "To Date  ", $cgi->textfield(-name=>'toDate'),
                $cgi->br(),
                $cgi->br(),             
                $cgi->submit(-value=>'Enter') ;
                
        
        print $cgi->endform() ;
}
########################################################################
##############
        




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to