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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Passing Fields

 



finkelman
Deleted

Jan 16, 2001, 10:35 AM

Post #1 of 2 (134 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



Jasmine
Administrator / Moderator

Jan 16, 2001, 1:54 PM

Post #2 of 2 (127 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 CGI.pm (and you should be :), you can use the following code:


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