until now i did and script that ask you a question and capture the variable
into a hash (see below), now, i would like to modify it and make something
that allows me to ask different questions using the same script
how can i do this?
Thanks
#! /usr/bin/perl
#use strict;
use CGI::Ajax;
use CGI;
my $q = new CGI;
my $concatter = sub {
my $buffer = $ENV{'QUERY_STRING'};
my @pairs = split( /&/, $buffer );
foreach my $pair (@pairs) {
my ( $name, $value ) = split( /=/, $pair );
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$Variables{$name} = $value;
}
print "<html><head></head><body>";
foreach (%Variables) {print "$_\n"}
print "</head></html>";
return ;
};
my $Show_Form = sub {
my $html = "";
$html = <<EOT
<HTML>
<HEAD><title>CGI::Ajax Multiple Return Value Example</title>
</HEAD>
<BODY>
<input type="hidden" id="item" size="6">
<input type="hidden" id="namedItem" size="6">
<form>
<input type="text" id="val1" size="6"><br/>
<br/>
<button onclick='jsFunc(formDump());return false' > Submit </button>
</form>
</BODY>
</HTML>
EOT
;
return $html;
};
my $Show_Form2 = sub {
my $html = "";
$html = <<EOT
<HTML>
<HEAD><title>CGI::Ajax Multiple Return Value Example</title>
</HEAD>
<BODY>
<h1>form2</h1>
</BODY>
</HTML>
EOT
;
return $html;
};
my $pjx = CGI::Ajax->new( 'jsFunc' => $concatter);
$pjx->JSDEBUG(1);
$pjx->DEBUG(1);
print $pjx->build_html($q,$Show_Form); # this outputs the html for the page
--
Pau Marc Muñoz Torres
Laboratori de Biologia Computacional
Institut de Biotecnologia i Biomedicina Vicent
Villar
Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)
telèfon: 93 5812807
Email : paumarc.munoz@bioinf.uab.cat