Click to See Complete Forum and Search --> : Sending variables


kjohn
07-14-2003, 06:20 PM
I just wanted to know, how do you send your variables from one form to another? I am using FormMail.cgi

This might be a question for the HTML forum, so I will ask there too...

Katie

jimr451
07-15-2003, 12:01 PM
Katie,

In general, you would submit the first form to a CGI, which does some processing and spits out the second form, with the variable values already set.

So the flow is sort of like:

form.html -> form.cgi -> (another form presented to the user) -> form2.cgi

etc. Keep in mind, form.cgi and form2.cgi can be the same script if you like. I do this a lot for larger applications, which require forms to be generated based on the prior submission, or with data from a database.

Hope this gets you started on the right foot.

-Jim

Charles
07-15-2003, 12:28 PM
Use the CGI module (http://www.perldoc.com/perl5.8.0/lib/CGI.html) to generate your HTML and especially your form elements. When a script that uses the module is called by an HTTP request any parameters are parsed behind the scenes. Then when you use the module to generate a form element with the same name as one of those parameters the element will be given the value of that parameter. Thus if you want to pass the value of a form element along just give the next form a hidden field with the same name. The CGI module will handle the rest.

kjohn
07-16-2003, 03:38 PM
Thanks for the replies, I think I will just have 2 separate emails sent w/ the forms. Much easier :)

Katie