View Full Version : 2 page forms - not loosing data
Mrjibbles
16th January 2007, 22:24
maybe i need a book or something but is there a easy way to explain
how a normal form which is large, can be split into 2-3 pages
so gives the impression of it not being such hardwork for the user
to fill in, so naffs of to another site?
If someone could give me a example - this is how ive got a normal text box
<input name="fname" id="fname" type="text" class="style2" value="" maxlength="45" />
Many thanks
Rob
andrew1810
16th January 2007, 22:49
You could have a full 2 page form, with the first page passing the variables to a hidden field on the second page, then they are all passed to the script to send the email etc.
Feel free to drop me an email if you need any pointers
Andrew
mattk
17th January 2007, 09:39
It does largely depend on what technology you want to use, but as a general overview you need to effectively "record" users input and there are several ways of doing this.
Firstly, if you are trying to use plain HTML you are very limited in your approach. Something like Andrew's suggestion to hold values in a hidden field, or to parse values in the querystring is about the limit of HTMLs ability. If you are prepared to use something like php or asp or even ASP.NET then much better solutions are available.
The best way to do it is using a session, which in simple terms is a notepad which you can record data specific to the particular user. You can use session to hold an ID, username etc, but you can also use it to hold user input over several pages, which is exactly what you are trying to do with your form.
Without knowing what technology you are using, it's hard to give you code-based examples, but have a look here for a pretty high level overview of how a user session works in asp.
http://www.w3schools.com/asp/asp_sessions.asp
awebapart.com
17th January 2007, 16:47
Another simple way of achieving this, is to split the form into 2 or 3 divs, and have wizard-like navigation buttons on the divs which control the next previous process and the visibility of the divs, so that only one div is visible at any one time. The field data in the invisible divs should still get posted. Div visibility can be controlled in Javascript using the div's CSS property style.display = either 'none' (for invisible) or 'block' (for visible)
dan_moore
21st January 2007, 21:23
Using a database of some sort to store the input as they go through the form is another way you could achieve this.
mattk
24th January 2007, 13:03
The only downside of saving to a database is you run the risk of ending up with incomplete records from people who quit half way though.