Forum Moderators: coopster & phranque

Message Too Old, No Replies

Need to convert a single page form into a 3 page form

Whats the best way for a rookie to do this?

         

is300

11:42 pm on Apr 10, 2004 (gmt 0)

10+ Year Member



I have a one page form that is too long and is on one single html page. It's submited through a perl script. I'd like to break it up across three pages but would still like to have the data emailed through one single email to the specified address. I've never done this before and don't know how to manage data from three pages so that it's emailed out through one message. does anyone know of any resources on the best way to do this?

JasonD

12:01 am on Apr 11, 2004 (gmt 0)

10+ Year Member



The simplest way is to pass the fields and values from each page to the next as hidden fields.

E.G.

Page 1 requests

Name

Page2 requests

Address

Page 2 hidden

Name and name value

etc.

is300

12:46 am on Apr 11, 2004 (gmt 0)

10+ Year Member



your instructions are taboo to me. Can you show me a specific example thats easy to follow?

Hissingsid

1:41 pm on Apr 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I guess from what you have said that you are using someone elses FormMail script to take the input from the form and email it to you. If this is the case then what you are asking probable can't be done unless the script that you are using is already set up for this purpose.

If you wrote your own script you would have something like this. This is just a very simple example with just one field on the form. You can have as many fields as you like.

##Script starts with the path to Perl shebang line
#!/usr/bin/perl

use CGI; ##Instruction to use the CGI.pm module which we are just using here to parse your form

$q = new CGI;

##The following stuffs the contents of your form field into $field1
$field1 = $q->param('field1');

##Error checking regex. You must check that the input is acceptable
##from user completed fields and from hidden fields each time they
##are passed to your script. I've omitted this here as it makes the thing
##look more complicated than it is.

print "Content-type:text/html\n\n";

##In this HTML you pass the value of your first form hidden and print a
##new field for the user to complete and pass on to the next cgi script.

print <<"EOF"; #sends everything to the users browser between this and the next time it finds EOF

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<form action="form2.cgi" method=post>
<input type=hidden name="field1" VALUE="$field1">
<input name="field2" value="" size=36 >
</form>
</body>
</html>

EOF

If you don't understand this you either need to get someone else to do the scripting for you, search for an off the shelf solution that does what you want or get a good book on Perl CGI and learn how to do it for yourself.

Best wishes

Sid