CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Passing Fields



Jan 16, 2001, 10:35 AM

Post #1 of 2 (146 views)
Passing Fields Can't Post

I am creating a form that will allow users to post and item on the site. Everything is working fine now. Here is the problem. I have quite a lot of fields that users need to fill out. I want to break that up to two pages. So the first page they'll fill out half the fields, they'll hit "NEXT", and they will fill out and submit the remaining fields.

My question is, how do I pass over the fields from the first page to the second page?

Thanks in advance

Administrator / Moderator

Jan 16, 2001, 1:54 PM

Post #2 of 2 (139 views)
Re: Passing Fields [In reply to] Can't Post

You can pass fields from one page to another by using HIDDEN tags.

For example, if you're using (and you should be :), you can use the following code:

my $in = new CGI; 

page1() unless $in->param('.page');
page2() if $in->param('.page') == 2;

sub page1 {
# page 1 stuff here

sub page2 {
# print page 2 stuff
print create_hidden_fields(); # creates hidden tags for previous page
#print </FORM> after hidden

sub create_hidden_fields {
my $tags;
for ($in->param){
$tags .= $in->hidden(-name=>$_) if $_ !~ /^\./;
# creates a hidden tag of all fields that do not begin with a period.
return $tags;

Hope this helps!


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives