in reply to Multi page form
Then a complementing cgiapp module:#!/usr/bin/perl -wT # this would be your .cgi file... let's say name.cgi use strict; use CGI::Carp qw( fatalsToBrowser ); $|++; use MyApp; my $webapp = MyApp->new(); $webapp->run();
HTH & Good Luck! - Jasonpackage MyApp; use strict; use base 'CGI::Application'; sub setup { my $self = shift; my $self->run_modes( [ qw( start add addnew ) ] ); } sub start { my $self = shift; my $query = $self->query; my $output = $query->start_html( -title => 'Simple Script' ); $output .= '<a href="name.cgi?rm=add">Start</a>' . $query->end_html; return $output; } sub add { my $self = shift; my $query = $self->query; my $output = $query->start_html(-title=>$title.' Enter your name'); $output .= $query->start_form . $query->hidden( 'rm', 'addnew' ) . $query->textfield('name','Enter Your name',20) . $query->submit('submit') . $query->reset . $query->end_form . $query->end_html; return $output; } sub addnew { my $self = shift; my $query = $self->query; my $text = 'Error , You should write your name'; if ( $query->param( 'name' ) ) { $text = "Welcome $name"; } my $output = $query->p( $text ); return $output; } 1;
Update: Feel free to drop in on the #cgiapp channel on irc.perl.org
Update2: bugfix ... that's not really the best code -- just something I whipped up as a prototype
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multi page form
by Anonymous Monk on Sep 28, 2005 at 15:09 UTC | |
by Purdy (Hermit) on Sep 28, 2005 at 15:21 UTC |