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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms in ASP

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I have a registration form to be filled out in my web site.<br>There are a number of steps for my registration.<br>So, I have divided the registration process into a number of steps.<br>The first form takes in the login information, the second forms takes in the address information and so on.<br>I have a image in the first form, which when clicked should take me to the second form.<br>Is it possible to take in information from all the forms and insert it into one table in the database or should I consider setting up seperate tables for each form.<br>Please let me know how this process is acheived in ASP. <p>Vijay Donthi<br><a href=mailto:vdonthi@ezode.com>vdonthi@ezode.com</a><br><a href= > </a><br>
 
When you get to each subsequent form, use ASPs <br>Request.item(&quot;txtfieldname&quot;) to request the value of an item and store it in a variable on the new form. And do this with every form until you are at the last form. Once at the last form go to a page where you call all the items from the previous forms and do an INSERT query using ADO to populate the database. <br><br>So it would be:<br>Form1<br>&lt;Form method=&quot;post&quot; action=&quot;Form2.asp&quot;&gt;<br><br>textbox1 name=text1<br>textbox2 name=text2<br>&lt;/FORM&gt;<br>------------------<br>Form2.asp<br>&lt;Form method=&quot;post&quot; action=&quot;Form3.asp&quot;&gt;<br>textbox1 type=hidden value=&lt;%=request.item(&quot;text1&quot;)%&gt;<br>textbox2 type=hidden value=&lt;%=request.item(&quot;text2&quot;)%&gt;<br>other textfields for form2<br>&lt;/FORM&gt;<br>----------------<br>Form3.asp<br>text1 = request.item(&quot;text1&quot;)<br>text2 = request.item(&quot;text2&quot;)<br>retrieve other text fields from form2 <br>Do an insert query where you would use text1, text2, etc. as the insert values.
 
Or you could just make session variables. Just make sure to set them to nothing before leaving. That way, you set them once on a page, and do not have to reference them again until right before you submit. This also will allow for a user to go back and change an answer if necessary without having to re-enter all of the information.
 
A little tip here:<br>When accessing items in the request object, you should always specify the collection you're interested in.&nbsp;&nbsp;Otherwise,&nbsp;&nbsp;all the collections get searched.&nbsp;&nbsp;It will get you a small performance gain,&nbsp;&nbsp;especially if the collection you're interested in is one of the last to get searched. IIS searches the collections in the following order:<br>&nbsp;1. QueryString<br>&nbsp;2. Form<br>&nbsp;3. Cookies<br>&nbsp;4. ClientCertificate<br>&nbsp;5. ServerVariables <br><br>so, in the example above, although request.item(&quot;text1&quot;) will get the right value, it would be better to specify request.form(&quot;text1&quot;).&nbsp;&nbsp;Although not absolutely critical, it's just good programming practice. <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top