Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html and cgi? 2

Status
Not open for further replies.

dontu

Programmer
Mar 17, 2006
14
RO
Hi all,
I want to introduce a hash in doc html and to press a button this hash it will to assume of prog perl and print by param keys/values.Can you help me somebody?

#!/usr/bin/perl
use strict;

use CGI;
print CGI::header();


my %disp = CGI::param('hash');
print"<b>Welcome</b>";
print"<hr>";
my @keys = keys(%disp);
my @values1= values(%disp);
if(%disp = ~m/\(? [a-z]*[,\s]?/x){
foreach (@keys){
print "This is key $_ \n";
foreach (@values1){
print "This is value $_ \n";
}
}
}
print"<hr>";
 
I think this is what you sare looking for

Code:
use CGI;

my $q = new CGI;

foreach my $key ( $q->param() ) {
    my @params = $q->param($key);
    my $value  = join( ", ", @params );
    print qq{ KEY: $key - VALUE: $value };
}

[URL unfurl="true"]http://unixjunky.com[/URL]
 
or:

Code:
#!/usr/bin/perl
use strict;
use CGI;
my $q = new CGI;
my %form = $q->Vars;
print $q->header,
      $q->start_html,
      '<b>Welcome</b><hr>',
      map {"This is key: $_ - This is value: $form{$_}\n"} keys %form,
      '<hr>',
      $q->end_html;

read the CGI.pm documentation for proper use of the module:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top