Thread CGI-Frage (Abfolge von 3 CGIs in eines packen) (17 answers)
Opened by Kuerbis at 2011-05-15 17:00

Kuerbis
 2011-05-16 13:30
#148674 #148674
User since
2011-03-20
938 Artikel
BenutzerIn
[default_avatar]
Auch hier komme ich nur bis zu zweiten Seite.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/local/bin/perl
use warnings;
use 5.012;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

my $cgi = new CGI();
my $step = $cgi->param('step') // 0;

my @functions = ( \&eins, \&zwei, \&drei );
my $function = $functions[$step] or die "invalid $step";
$function->();

sub eins {
        print $cgi->header();
        print $cgi->start_html();
        print $cgi->p('eins');
        print $cgi->startform();
        print $cgi->hidden( -name => 'step', -value => 1 );
        print $cgi->submit( 'OK' );
        print $cgi->endform();       
        print $cgi->end_html();
}

sub zwei {
        print $cgi->header();
        print $cgi->start_html();
        print $cgi->p('zwei');
        print $cgi->startform();
        print $cgi->hidden( -name => 'step', -value => 2 );
        print $cgi->submit( 'OK' );
        print $cgi->endform();   
        print $cgi->end_html();
}

sub drei {
        print $cgi->header();
        print $cgi->start_html();
        print $cgi->p('drei');
        print $cgi->startform();
        print $cgi->hidden( -name => 'step', -value => 0 );
        print $cgi->submit( 'OK' );
        print $cgi->endform();   
        print $cgi->end_html();
}

View full thread CGI-Frage (Abfolge von 3 CGIs in eines packen)