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

Passing Data Through multiple pages

Status
Not open for further replies.

RussOSU

Technical User
Apr 16, 2001
93
0
0
US
I have created a form in which a customer will enter information required to complete a job. I have this information being passed to an .asp page in which I want to have a confirmation. If the person says yes all the info is right the data will be passed to a database/emailed to someone. Where if they want to change something they get taken back to the original data entry form. But this whole time I want the data to get passed to the pages.

I know this is sounding confusing. So summary I have an html form and want the data passed to my .asp page where on this page they confirm or change the request. Confirm would mean the data gets passed to a database and emailed to someone. Where as changing info would take them back to the form where all the data they entered originally would be there.

Is this possible?
 
RussDog,

I use the same logic as I guess a lot of other people do. Basically, I start with a blank form that has a SUBMIT button and submits the form to itself. This is basically it.
The variables are all on the same page, too. Hope this helps!

Fengshui1998

--------- FORM.ASP ----------------

<html>
<head><title>My form</title></head>
<body>
<%
action = request.querystring(&quot;action&quot;)
if action = &quot;Add&quot; then
....some code here
username = request.querystring(&quot;username&quot;)
paycode = request.querystring(&quot;paycode&quot;)
....
....
elseif action = &quot;Update&quot; then
....some code here

elseif action = &quot;Delete&quot; then
....some code here

end if

%>

<form name=form1 method=&quot;get&quot; action=&quot;form.asp&quot;>
<input type=&quot;text&quot; name=&quot;username&quot; value=&quot;<%=username%>&quot;>
<input type=&quot;text&quot; name=&quot;paycode&quot; value=&quot;<%=paycode%>&quot;>
<input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Add&quot;>
<input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Update&quot;>
<input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Delete&quot;>
</form>
</body>
</html>
 
I am not sure I really understand what you mean by the code. Sorry like I said I am a newbie to this programming thing. If I have created a form on an .html page how do I go about this? It isn't possible to pass form information to itself as .html is it? What does passing form information to itself accomplish?
 
russdog,

By passing information to itself, the lines between <% and
%> are executed on the server. You can retrieve information from databases, create variables, loops and all sorts of stuff before you actually display it at the browser. There you can validate the user at the same time depending upon action taken.

Once you've done what you want to do on the server, you can display your information in the form with <%=variablename%>.

fengshui1998
 
Also note that in order for your original &quot;html&quot; page to accept any forms, it must also be an ASP page.

So, you have two .asp pages, one collecting the information into visible input text boxes and the other to accept the data and display to the user what they just typed in for verification via the Form/Submit method.

for the second .asp page to work you need to collect the data back into another form. One method to accomplish this is to use the hidden input type such as:

<input type=&quot;Hidden&quot; name=&quot;p_data1&quot; value=&quot;<%Request.Form(&quot;p_data1&quot;)%>&quot;>

which in effect collects the data from the previous form page an inserts it into a new container which is hidden from the user... (as you are only displaying info here)

now when the user selects to change the data you would submit this new populated form back to the original .asp page (this is why they both need to be .asp) and collect/populate each input box.

when the first .asp page is served up the first time there would be no data to collect so each field will be blank.

if your going to the database then i would send the whole form to a new .asp business logic page that instantiates the ADO connection and inserts the data.

should work...


 
When I pass the form data back to itself would I include a redirect command inorder to pass the data to the new page, or would I pass the information to the new page and have a hidden input that has a variable defined for everything? How would I define this variable so that when I passed the information back to the first page that it seperates it out again? Sorry I am just dumb when it comes to programming.

Russ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top