Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

Multiple Page Forms

How in the heck can this be accomplished?



6:00 pm on Jun 11, 2002 (gmt 0)

10+ Year Member

I am trying to develop a form that has multiple pages (ex. fill out form on first page then click next until all pages are complete and at the end submit the data). The problem is that I am not a programmer and I have no programming experience - is there anyway I can accomplish this?

[edited by: OhMyPixel at 6:29 pm (utc) on June 11, 2002]


6:04 pm on Jun 11, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Learn to program ;)

Sorry, couldn't resist it. If you can't program though, it really isn't that hard to learn enough to use cookies on a form.

Does your host run php? that's how I'd acomplish it though there are a few pretty handy JS whizzes round here that might help...



6:08 pm on Jun 11, 2002 (gmt 0)

WebmasterWorld Senior Member ciml is a WebmasterWorld Top Contributor of All Time 10+ Year Member

The easiest way in Perl is probably to use cgi.pm to maintain state via HTTP POST forms. The documentation [stein.cshl.org] is quite straightforward, and includes information about saving state to a file for loading back later, but as Nick suggests I imagine that you would be better off collaborating with a programmer.


6:08 pm on Jun 11, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

sorry OhMyPixel but I think you are going to have to do some sort of programming to accomplish this. I would go with a single page form until you get something else working.


6:25 pm on Jun 11, 2002 (gmt 0)

10+ Year Member


how or where would one learn to accomplish this through cookies? I think (and hope) I could learn how but I just need somewhere to start <analogy> I feel like i've been plunged into a dense forest and now I have to find my way out with no map. So I'm sitting here with my flare gun shooting into the sky hoping to attract attention from someone who's familiar with the area </analogy>.

With websites there is usually a simple & dirty way to get things done and then there is a complex & neat way to do it. I think this is going to be a situation were this applies. I want to avoid the simple & dirty as much as possible.

[edited by: OhMyPixel at 6:32 pm (utc) on June 11, 2002]


6:31 pm on Jun 11, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member


well, does your host run php?



6:34 pm on Jun 11, 2002 (gmt 0)

10+ Year Member

I don't believe I currently have a plan that supports PHP but I can make that so if it is necessary. For the purposes of this can we assume that I have PHP capabilities?


7:11 pm on Jun 11, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Okay here is a little untested, unsafe, unsound and lots of other things beginning with 'un' snippet to get you going:

In your html on each each page of the form:

if($HTTP_POST_VARS) { // if form has been posted
foreach($HTTP_POST_VARS as $key => $val) {
setcookie($key, $val, time()+3600); // set cookie for one hour for each form field
} else {
print("You must fill in all the fields");

and on your last page do exactly the same and then:

$subj="New contact form";
$msg="\nHere are the details:\n";
$extra="From: contact@his_site.com\nReply-To: $whatever_you_called_this_field\n";

foreach($HTTP_COOKIE_VARS as $key => $val) {

mail($email, $subj, $msg, $extra);
That's really not very comprehensive solution but it might get you started ;-)



7:24 pm on Jun 11, 2002 (gmt 0)

10+ Year Member

Holy Scripting Batman!

I'm slightly scared just looking at the script you wrote. I'm not sure I quite understand how it works. I apologize - I've never had any programming experience. I guess what you are doing, in the most basic sense, is setting the cookie to store info and then submit it on the final page. I understand that in concept, but I don't quite understand the implementation of it.

One other question: Would it be easier to set cookies using Javascript?

I appreciate all your time/input.


8:00 pm on Jun 11, 2002 (gmt 0)

I think there is a pitfall here somewhere but I canít remember where.

A possible option is to have the form on different layers in the same html page. The user navigates through the layers until he/she gets to the final layer with the submit button on it. Then all the fields get submitted to your run of the mill form handeling script at the one time.


8:33 pm on Jun 11, 2002 (gmt 0)

10+ Year Member

Using JavaScript to set cookies is possible, but not really recommended: first, it requires some extra programming (JavaScript reads all the cookies as one single string, which you then have to parse and split up into individual cookies) and many people have JavaScript turned off.

It's best to use server-side programming, such as PHP. Using PHP, you don't need to use cookies at all (which is good, because many people distrust cookies, and have their browsers set to either refuse cookies, or to ask first before setting them). For example, if on page1.php you have the following code:

<input type="text" name="foo">

then, on page2.php it becomes available to PHP as a variable called $foo, which you can write in as the value of a hidden field:

<input type="hidden" name="foo" value="<?=$foo?>">

...and so on, for all the pages of your form. This is, in fact, exactly what hidden form elements were designed for.

On the other hand, you want to be careful when designing forms. They should be as short and easy to understand as possible, and multiple page forms should really be used only if absolutely necessary.


8:35 pm on Jun 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

There are several schemes for maintaining info across pages:

  1. You can store all of the info on the client side in a cookie. Beware that there are limits on how much info you can store in a cookie, although it varies among browsers.
  2. You can store the info on the server side in a database. Using a cookie for a customer ID, you keep track of the info in the database. The problem is people who balk: when do you purge that info from the database?
  3. You post hidden fields from page to page accumulating the info from previous pages into the hidden fields until the accumulated info is posted to the final processing script.

All three require knowledge of scripting in some form or another. This kind of thing is one thing that .NET makes easier.


9:05 pm on Jun 11, 2002 (gmt 0)

10+ Year Member

Paste the following into a file called FORM.ASP...

<FORM METHOD="post" ACTION="/nextform.asp">
<INPUT TYPE="text" NAME="field_001">
<INPUT TYPE="text" NAME="field_002">
<INPUT TYPE="text" NAME="field_003">
<INPUT TYPE="submit" VALUE="Next">


Paste the following into a file called

' Now we take the info from FORM.ASP and turn it into variables.

DIM field1, field2, field3

field1 = request.Form("field_001")
field2 = request.Form("field_002")
field3 = request.Form("field_003")

' We can then take those variables and place them into hidden input field in the next form by calling those variables like so...

<FORM METHOD="post" ACTION="/thirdform.asp">
<INPUT TYPE="hidden" VALUE="<%=field1%>">
<INPUT TYPE="hidden" VALUE="<%=field2%>">
<INPUT TYPE="hidden" VALUE="<%=field3%>">
<INPUT TYPE="submit" VALUE="Next">

' The hidden fields pass on info behind the scenes and are great for this kind of data transfer. Basically, you're useing ASP to create the values of the hidden fields from the form before it, and then you can do the same to pass more info to the next form, which in this case would be THIRDFORM.ASP - and so on. %>


Things to remember:

All ASP code must begin and end with "delimiters" which would look like <% this %>. This is how the server knows that it needs to process ASP code. You also must be on a server that's running some flavor of a Windows server since ASP is owned by Micro$oft.

You can store ANYTHING in a variable, but make sure that you define it like so:

DIM myname, yourname
myname = "Steve"
yourname = "OhMyPixel"

If you request.Form("formfield") then you don't have to use quotes like I did for the myname and yourname variables.

You might want to do a Google Search for the ASP Message Board. They can help you more on this subject if you choose to use ASP.

I like it because it's EXTREMELY easy to use once you get down the fundamentals.

Good Luck


9:35 pm on Jun 11, 2002 (gmt 0)

10+ Year Member

HyperGeek beat me to it. I was going to suggest doing the same in JSP.


10:51 pm on Jun 11, 2002 (gmt 0)

10+ Year Member

Since Nick_W threw the code up I decided it was time to get my backside in gear and start learning the basics of programming (can you hear the crowd scream in unison "yay!"). I'm learning some javascript first, then PHP, then VBSCRIPT. If you have any suggestions on order/importance, etc. please let me know.

Sequill, your suggestion is interesting although I am not comfortable enough with layers to pursue that solution. It might be something to consider in the future.

Rewboss, I had an idea of this just no clue on where to start.

XOC, thank you! A basic idea of what options are available is EXACTLY where I needed to start.

Hypergeek, YOU ARE AWESOME! The coolest thing is that my hosting service doesn't have CGI support because it runs on IIS 5.0 (they whine about potential security problems). This is definitely what I'm looking for - I'll take a deeper look at it once I get home and I'll be making a post a little bit later.

Thank you to everyone. If you have any more info to share please don't hesitate!


1:26 am on Jun 12, 2002 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

a little late to the party but...
There are also free CGI scripts like AlienForm [cgi.tj] that, with a bit of template tweaking, may do what you want with templates without having to dirty your hands with scripting/programming too much...unfortunately you don't have CGI on your host I see...


2:18 pm on Jun 12, 2002 (gmt 0)

10+ Year Member

Two books I highly suggest:

1. ASP For Dummies (third edition): This book is fantastic and goes through everything from the basics to reading and writing from/to a database. Even goes into some SQL stuff.

2. ASP Instant Reference: The best ASP reference book out there. Complete as complete can be when it comes to VBSCRIPT - and yes, also covers some SQL.

ASP is a very easy language to learn and you can sprinkle it within HTML to make those pages flexible and dynamic.

I would suggest the following course of action if you're interested in learning how to code.

- Brush up on your HTML and then...

a) Learn some ASP/VBScript.

b) Download some JavaScripts so that you can validate your HTML forms - this will be an great intro to JavaScript (which becomes important when you're working with forms).

NOTE: I have never really "learned" JavaScript because of the ABUNDANCE of ready-made scripts available on the Internet. What i would suggest is to search Google (or your favorite SE) for JavaScript web sites - or even for the type of script you need (EX: form validation javascript). Then you can edit those and play around with modifying them in different ways (and even possibly combining them with other JavaScripts). This is what I've been doing for the last five years - and even though I own plenty of books on the language, I rarely use it for anything but form validation (and sometimes internal content pop-ups).

c) Get a book on CSS (Cascading Style Sheets). This is soemthing that, when you want to take a break from the ASP, you can fool around with CSS. This is a handy thing to know and compliments any web page nicely. It's also soon to be the standard in many other things besides font manipulation and text positioning.

d) XML. This is when you get hardcore. It basically allows you to create your own form of markup language (like HTML).

Have fun.

- Check out W3Schools and ASP 101 for ASP tutorials. ASPMessageBoard (3GuysFromRolla) for a very lively support group.

- Javascript.Internet.com & Javascript.com have lots of scripts and so does Doc JavaScript and www.webReference.com/js/.

- The CSS Master Grid can be found here (it'll help greatly when it comes to Netscape/IE cross browser compatibility issues)...


...and more info on CSS can be found by digging around www.w3.org (The WWW Consortium).

Have fun learning how to code... I know I do!

NOTE: I'm a high school dropout that's completely self-taught. My site, Hypergeek.com, is an entertainment-oriented directory coded entirely in notepad.exe with VBSCRIPT, SQL, CSS, XML and Javascript. If I can accomplish this, I'm convinced that anyone can - as long as they take the time to learn and ask questions.


3:20 pm on Jun 12, 2002 (gmt 0)

10+ Year Member

Bill, I've actually already downloaded AlienForm and started looking at it just for kicks. I've signed up another account with a webhost that provides CGI-Bin access for free so I'm gonna check that out.

Hypergeek, THANK YOU. I have copied this whole thing into word and have saved it for when I get a chance to browse a little bit more (I'm at work). It sounds like you have quite a bit of knowledge on the subjects - Thank you for taking the time to share it.

Update: I started to learn JavaScript yesterday and I'm just aiming to get the basics of the language down because it is needed for one of the projects here at work. I'm doing pretty well and I've ordered a few used books from Amazon (anyone else do this? its a steal) on the subject. My next goal is to get on ASP and VBScript. If I am correct ASP is just the extension while VBscript is the language used to write the code for .ASP files?

sitenote: I have to watch myself now because I use to tell all my programmers at work that programmers are WEIRD FREAKS. It looks like I've been assimilated. Uh oh.


4:55 pm on Jun 12, 2002 (gmt 0)

10+ Year Member

Correct, ASP is actually the name of the technology (Active Server Pages) not to be confused with the service provider acronym also commonly used.

Active Server Pages uses the VBScript code type based a a simple version of VB (Visual Basic).

I've never written VB, but I've been told - although a lot more complex and in depth - it's syntax (the way the code and code structure is written) is similar.

I would like to stress the point of not going crazy with the JavaScript. It's a handy thing to know, but when it comes down to CODING - sometimes there'll be things that you don't want someone to see if they "view source" on one of your pages. Anything you write in VBScript is processed on the SERVER side (thus the user - or client - won't ever see your code, just the HTML output!) - but anything you write in JavaScript will be used client side (by the user's browser/computer) and is most often visible and clunky if you concern yourself with overall page size (and the time it takes to download that page).

Javascript also can defeat the purpose of optimizing a page - because it's sometimes considered part of your content by various spiders and can be indexed as such when your site is crawled. It not good to have lines of JavaScript as your site's description - even if the site's about Javascript. :)


Most people throw the JS up in the HEAD of a page - but sometimes, if there's more than just a form validation script up there, it can slow down the load time of that page because the script is being processed before the HTML is.

Try this... Throw your JS underneath the </HTML> tag. It will STILL be processed, but immediately AFTER the page is loaded for the user instead of before. By the time the user needs to have the functionality of the script working on the page, it will have already loaded, and the page might have displayed anywhere from 3 to 5 seconds faster.

This may seem nitpicky, but when you consider all of the stuff added to some pages by the time they're completed - these few seconds trimmed here and there can be the difference of a page being fully loaded in 3 seconds instead of 12.

WebmasterWorld.com: For Freaks, By Freaks.


6:36 pm on Jun 12, 2002 (gmt 0)

10+ Year Member


def. a good idea (positioning of javascript). I was reading about this a few minutes ago on a website.

I never planned on becoming a hardcore javascript coder - I just wanted to get a good understanding so that I could use what is out there and also improvise when necessary. What sources do you use for free javascript besides 'view source'?


7:00 pm on Jun 12, 2002 (gmt 0)

10+ Year Member

Anything you write in VBScript is processed on the SERVER side (thus the user - or client - won't ever see your code, just the HTML output!) - but anything you write in JavaScript will be used client side (by the user's browser/computer) and is most often visible and clunky if you concern yourself with overall page size (and the time it takes to download that page).

Not true. Sometimes it may seem that way, but that's not the way it is.

Both JavaScript and VBScript can be, as it were, "stand-alone": that is, both can execute independently of a browser, both can be used for server-side programming. However, JavaScript is almost never used in this way, and VBScript often isn't. In fact, you can embed VBScript in an HTML document in exactly the same way you embed JavaScript.

The problem with client-side VBScript is that it's a Microsoft thing: that is, it will only work on a Microsoft browser. You also need to install the interpreter -- I haven't, and am often prompted to install it on downloading a website, because the site uses embedded VBScript. JavaScript is cross-browser compatible, although there are major differences in the way it interacts with the browser's DOM (and here we're talking about DHTML).

Server-side VBScripts -- and this includes ASP -- are generally available on Microsoft servers, but not always (or possibly never, I'm not sure) on UNIX servers -- and the majority of hosts use UNIX. But if your host does support ASP, you don't have to worry about what browser is being used, because the server-side script doesn't care (unless you specifically tell it to care).

If you want to remove JavaScripts from your HTML files (for ease of indexing or whatever), you can use external .js files, called by the src attribute of the <script> tag. You can then use the same script for different pages, and these files -- just like images -- are cached, so it actually cuts down on bandwidth in the long run.


8:49 pm on Jun 12, 2002 (gmt 0)

10+ Year Member

Thanks for that post, Rewboss.

I was "profiling" the types of scripting for simplicity.

I use external .JS, too - but when you include and import more than two or three external files - it can tend to slow down load time.

Then again, if you're on a good server and receive modest traffic... then you probably won't even notice the difference with more than an eye blink.

Also, you can View Source and then gank the external files. That's why I love server-processed pages. It doesn't deliver what you might not want it to.


9:52 pm on Jun 12, 2002 (gmt 0)

10+ Year Member

Another option is to put the form(s) page(s) in a frame set. You can then just change one frame and store all needed info in the other (invisible) frame.


12:55 am on Jun 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Here is one I love and it's free and does not require you to be able to program: [cgi.tj...]

Oops - I see someone has already mentioned it. Well if you have any questions shoot them to me - been using it for years in hundreds of situations



3:44 pm on Jun 13, 2002 (gmt 0)

10+ Year Member


Is it possible for the final page to display the information and also have the submit button?

I tried using response.write but I guess my formatting is incorrect. Can you help me with the last page that will submit it to an e-mail address?


What I have so far can be found on my test server at:


Also, I've noticed that my first form field isn't carried over to the final page. is my code incorrect?


6:49 pm on Jun 13, 2002 (gmt 0)

10+ Year Member

Whoops. In my posted code, I didn't put the NAME attributes in the hidden fields. Do this in NEXTFORM.ASP:

<INPUT TYPE="hidden" VALUE="xxx" NAME="field_001">
<INPUT TYPE="hidden" VALUE="ccc" NAME="field_003">
<INPUT TYPE="hidden" VALUE="vvv" NAME="field_003">

Now you can pass those values onto the next page.

To print (display) them to the page do the same thing you did with the form's VALUE attributes.

NAME: <%=field1%>
AGE: <%=field2%>

Printing a variable to a form field is the same as printing it to the page itself. The only difference is that the form hides the code you're processing (unless you use a text field and print the variable as VALUE="<%variable%>") - then it will display that info inside the form field for the user to see).


11:35 am on Jun 17, 2002 (gmt 0)

I can see this as FAR too complicated for poor ohmypixel.

How about this as a way to avoid programming and cookies altogether:
1) Using Frontpage or whatever wysiwig editor you use to create a form of one page (your first page). Call it response form 1 or something and add the time of day or IP address of the user if your wysiwig editor allows it.
2) Have the results emailed to you.
3) Make the confirmation page ANOTHER FORM... which does exactly the same thing, and so on.

The result is a series of emails for the same form, but if you don't expect hundreds every day, it is at least an easy way to start. If you can "marry them all up" with the same IP number on every form then even better.

Not exactly a programmer's solution, but I think you are looking for something simpler and this is it.


8:18 pm on Jun 26, 2002 (gmt 0)

10+ Year Member


I got it working and it was a CINCH! Absolutely flawless. My client is more than happy and finds that breaking it into a couple pages was a great idea (yay me!). I appreciate all your help.

If you want a URL of the product sticky me.


p.s. receptional I don't know whether to be offended or grateful :P.


Featured Threads

Hot Threads This Week

Hot Threads This Month