ile has asked for the wisdom of the Perl Monks concerning the following question:

Hi, im pretty newbie in all this so i hope i dont ask stupid stuff....

I have to make an form which is guiding through several steps with form builder

1.step (choosing type to upload video, audio, picture)
2.step (a form for entering info which is different depending on the cathegory)
3.step (uploader which again differs depending on the cathegory)


Please can you tell me which could be a right way to make this?
i was trying to make an "if" thing but i didnt really succeed:

my @video=qw(format director producer acter); my @audio=qw(album song); my @picture=qw(photographer style size); my $form1=CGI::FormBuilder->new( fields=> \@all, method=>'POST' );

- how can i make @all change depending of the value of $choose?
- is there a way to have a variable array name @{$choose}?
-is there any suggestion what is the best way of making this?


Thanx a lot
ile

Replies are listed 'Best First'.
Re: FormBuilder - here is some working code
by parasew (Beadle) on Sep 23, 2003 at 02:39 UTC
    here is a suggestion how to solve your problem adressing the CGI::FormBuilder issues. you don't need the "variable variables" - use hashes and references instead. (Why it's stupid to `use a variable as a variable name')

    #!/usr/bin/perl use CGI; use strict; use warnings; use CGI::FormBuilder; # your scripname goes here my $self="form-test.cgi"; my %hash = ( video => "format director producer acter", audio => "album song", picture => "photographer style size", ); my $cgi_instance=new CGI; print $cgi_instance->header; my $approved_todo=$cgi_instance->CGI::param('todo'); if (defined($approved_todo)) { #going inside here if $act is defined print "you selected ".$approved_todo."<br>"; #your complete CGI::FormBuilder Code goes here my @all = $hash{$approved_todo}; my $form1=CGI::FormBuilder->new( fields=> \@all, # and so on with your FormBuilder Code } else { #go inside here if $act not defined print "choose your way of uploading<br>\n"; my @temp_array=keys %hash; foreach my $temp_todo (@temp_array) { print "<a href=\"".$self."?todo=".$temp_todo."\" act=1>".$temp_tod +o." upload</a><br>\n"; } }; print $cgi_instance->end_html;

      Thanx a lot!
      this is really helpfull
      i thought nobody will answer :)
      thanx!
      ile