Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form with multiple pages

Status
Not open for further replies.

mechro99

Programmer
Nov 27, 2001
54
US
Hi,

Is there a way to take a long form with too much scrolling and break it up onto separate pages, and then submit all the information from the previous pages with a button at the final page?

Thanks,
Dan
 
Ya what you do is have each page's form post to the next page(except for the last one). like this...<form method=&quot;post&quot; name=&quot;name&quot; action=&quot;nextformpage.html&quot;>...the last one to wereever you want the form posted.
Then to carry each of the users inputs from one page to the other use a hiden form field ...you can find out about more of these at w3schools.com or htmlgoodies.com ....if that doesn't post back here and ill try an help ya.
Jammer1221
 
Jammer,

Thanks for the clues. I'm having trouble finding info at the links you provided about hidden form fields.
Can you give me any more about how to post from the previous page to the following page?

My form will have two pages. The first has about two dozen entry fields, drop boxes, etc. What do I need to do on the following page? I think I follow you in terms of programming the first page's form to post to the next page, but where do the hidden fields come in? How do I use them, and where?

Thanks a lot for the help.
 
hmm i'm sorry those links didn't have any information well first i need to know what server side language your gonna be using once you have the information...Like PHP , CGI, or ASP. Just to answer your other question the hidden field's are gonna be in your second page...I'll tell ya how to write them in a second...They kinda depend on the server side language your gonna use.
Jammer1221
 
Well, I'm kind of learning this as I go. Thus far I've only created forms that uses e-mail to send, which I know is a no-no in the practical world. I've not yet learned any other ways to do so, but I've heard the term &quot;cgi&quot; more than any of the others. I'll have to research to find out exactly what the difference is between the other server side languages are, but would cgi be the most likely or common one?
 
Well it depends on the purpose of the forms...PHP/MySQL is probably one of the easiest and most common server side/database combination's out there...You would use PHP/MySQL to get the users info an store the dynamically and recall them. CGI/Perl is a tougher language to learn but once you learn it you can do all sorts of things. ASP/SQL is probably the second most popular server languages. It is almost as tough as CGI to learn but you can do alot more with it than CGI and you can also do the same stuff with it as with PHP. In order for you to use any of these languages you have to have them on your server. Hence the name server side languages. I would recomend PHP/MySQL as it is free a farely easy to learn ecspecailly for simple information collecting. It is also most common on a commercial server. CGI is the most common on a Free server. and don't worry about the email thing your doing thats were i started out. The next time i post i'll probably have the hidden input tags you need im just testing them out to make sure what i give you is true and works.
Jammer1221
 
Umm ive decided to write you a cookie script that sets the cookie twice. I decided to do this because you can use cookies with what ever server side language you choose. Unlike hidden fields can only be used with CGI.

This is the script to write the cookie

Code:
<html>
<head>
	<title></title>
	
	<script language=&quot;JavaScript&quot;>
	function process(){
	var t1 = document.form1.t1.value;
	var t2 = document.form1.t2.value;
	var t3 = document.form1.t3.value;
	
	var stuff_for_cookie = &quot;T1:&quot; + t1 + &quot; T2:&quot; + t2 + &quot;T3:&quot; + t3 + &quot;&quot;;

	document.cookie = escape(stuff_for_cookie);
	}
	</script>
</head>

<body>
<form name=&quot;form1&quot;>
<h4>Text 1</h4>
 <input type=&quot;text&quot; size=15 name=&quot;t1&quot;><br>
<h4>Text 2</h4>
 <input type=&quot;text&quot; size=15 name=&quot;t2&quot;><br>
<h4>Text 3</h4>
 <input type=&quot;text&quot; name=&quot;t3&quot;><br>

 <input type=&quot;button&quot; value=&quot;Submit&quot; onClick=&quot;process()&quot;>
</form>



</body>
</html>

this is the script to view the data in the cookie
Code:
<html>
<body>
<script language=&quot;JavaScript&quot;>
var cookie_stuff = unescape(document.cookie);
</script>

<script language=&quot;JavaScript&quot;>
document.write (cookie_stuff);
</script>

</body>
</html>

if you need any more help cause i know cookies are way confusing. Just post back here and ill try to help you. Sorry i know this isnt exactly what your looking for. If you choose PHP as your server side language I can deffiently tell ya what to do there as far as forms.
Jammer1221
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top