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

Kuerbis
 2011-05-15 17:00
#148627 #148627
User since
2011-03-20
957 Artikel
BenutzerIn
[default_avatar]
Hallo,

könnte ich diese drei Skripte in einem einzigen unterbringen oder braucht es hier diese drei Skripte?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# eins.cgi
use CGI;
use JSON;

my @array = (   [ 1, 'eins', '12/11/10', 'sn' ],
                [ 2, 'zwei', '11/12/09', 'cp' ],
                [ 3, 'drei', '04/09/11', 'cp' ]
);
my $radio_values, encode_json /@array;

my $cgi = new CGI();

print $cgi->header();
print $cgi->start_html();
print $cgi->startform(  -action => 'zwei.cgi', -method => 'POST' );
print $cgi->radio_group(        -name           => 'choice',
                                -values         => [ @$radio_values ],
                                -linebreak      => 'true' );
print $cgi->submit( 'OK' );
print $cgi->endform();       
print $cgi->end_html();


Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# zwei.cgi
use CGI;

my $cgi = new CGI();
my $choice = $cgi->param('choice');

print $cgi->header();
print $cgi->start_html();
print $cgi->startform(  -action => 'drei.cgi', -method => 'POST' );
print $cgi->hidden(     -name => 'choice', -value => $choice );
print $cgi->h2( "Rating: $choice" );
print $cgi->popup_menu(         -name           => 'rating',
                                -values         => [ '+++', '++', '+', '0', '-', '--', '---' ],
                                -default        => '0' 
);
print $cgi->br();
print $cgi->submit( 'OK' );
print $cgi->endform();   
print $cgi->end_html();


Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# drei.cgi
use CGI;
use JSON;

my $cgi = new CGI();
my $choice = $cgi->param('choice');
my $rating = $cgi->param('rating');

my $a_ref = decode_json $choice;
my $name = $a_ref->[1];
my $table = $a_ref->[-1];

print $cgi->header();
print $cgi->start_html();
print $cgi->p( "Table: $table<br />Name: $name<br />RATING: $rating" );
print $cgi->end_html();


modedit Editiert von GwenDragon: Titel erweitert
Last edited: 2011-05-16 18:14:23 +0200 (CEST)

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