|
| |
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
Can ASP post request form? - 10/1/2003 13:48:46
Hi there, I have a form that post to an asp page this will insert data into the database, After inserting the data I response redirect to the next form and so on, is there any way To post one of the field of the first form into the second form, because I want to avoid Re-typing per example customer id on each form. I did include a form on my asp page did work but I’m wondering is there any way with asp to post the request form ? Thanks a lot
|
|
|
|
ou812
Posts: 1572 Joined: 1/5/2002 From: San Diego Status: online
|
RE: Can ASP post request form? - 10/1/2003 13:56:34
You can do something like: response.redirect("customer_entry.asp?customer_id=" & cust_id) And then in the called ASP page do this: passed_customer_id = request.querystring("customer_id") -brian
|
|
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
RE: Can ASP post request form? - 10/1/2003 14:08:26
quote:
And then in the called ASP page do this: passed_customer_id = request.querystring("customer_id") thanks 4 reply I did the same but didn't work!
< Message edited by Light -- 10/1/2003 3:13:11 PM >
|
|
|
|
ou812
Posts: 1572 Joined: 1/5/2002 From: San Diego Status: online
|
RE: Can ASP post request form? - 10/1/2003 16:15:26
Can you cut/paste exactly what you are doing? This is how I do it and it works fine for me. You could also try a response.write(passed_customer_id), or something along those lines, to see if it did get passed or not. -brian
|
|
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
RE: Can ASP post request form? - 10/1/2003 23:42:42
Hi Brian! The first page "1.asp" has the customer_id field, page 1.asp post the field data into the "insert.asp" this page insert data into database. after inserting the data "insert.asp" redirect to the page "2.asp" "2.asp" has the same field as "1.asp", which is customer_id field how customer_id from "1.asp" can be posted to "2.asp"? I put initial value for customer_id field on 2.asp as follow: <%=Request("customer_id")%> and I think is wrong! thanks a lot.
|
|
|
|
ou812
Posts: 1572 Joined: 1/5/2002 From: San Diego Status: online
|
RE: Can ASP post request form? - 10/2/2003 0:19:36
What you have should display correctly if it passed right. I would change request to request.querystring (I don't believe that would break or make it work, but I think it speeds up the calling of request). When you redirect from insert.asp to 2.asp you should do this: <% response.redirect("2.asp?cust_id=" & customer_id) %> And in 2.asp do this to get the value and use it: passed_customer_id = request.querystring("cust_id") Or what you have to just display it. And if you go from 2.asp to insert2.asp, or whatever, you will have to keep passing it. If the above doesn't work, are you able to response.write the value after it is passed into 2.asp? (<% response.write request.querystring("cust_id)%>) -brian
|
|
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
RE: Can ASP post request form? - 10/2/2003 0:26:15
thanks Brian, on 2.asp customer_id is text field so what should I put as initial value? thanks
|
|
|
|
ou812
Posts: 1572 Joined: 1/5/2002 From: San Diego Status: online
|
RE: Can ASP post request form? - 10/2/2003 0:57:33
Hi, I'm not quite sure what you are asking. Are you asking what the form field text box should/could look like? <input type="text" name="cust_id" size="10" value=<%= request.querystring("customer_id") %> > -brian
|
|
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
RE: Can ASP post request form? - 10/2/2003 2:21:02
Thanks for your time but didn't work! too bad, I think I better use a form to post the data to the other page!
|
|
|
|
ou812
Posts: 1572 Joined: 1/5/2002 From: San Diego Status: online
|
RE: Can ASP post request form? - 10/2/2003 12:49:25
Hmm, sorry it isn't working for you. The stuff I showed is pretty much what I do on some of my pages. I guess I must not be understanding what your situation is. Sorry. -brian
|
|
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
RE: Can ASP post request form? - 10/13/2003 22:02:46
quote:
<% response.redirect("2.asp?cust_id=" & customer_id) %> Hi brian, could you please explain what is cust_id?
|
|
|
|
chasta
Posts: 87 From: IL Status: offline
|
RE: Can ASP post request form? - 10/14/2003 0:37:09
Okay, I think (I hope!) I understand what you're trying to do here. Let's see if I got this right: - Your first page, 1.asp, has a form. One of the fields in that form is customer_id.
- After the user clicks the submit button on 1.asp, it goes to your second page, insert.asp, where it uploads the information into a database.
- After insert.asp has done it's job, it redirects to another page, 2.asp. 2.asp also has a form that contains a customer_id field. You want the same information that was put into the original customer_id field on 1.asp to appear in the customer_id field on 2.asp.
Is that right?
_____________________________
"You can only be a victim if you admit defeat." -Descendents
|
|
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
RE: Can ASP post request form? - 10/14/2003 1:05:44
Hi chasta, yes
|
|
|
|
chasta
Posts: 87 From: IL Status: offline
|
RE: Can ASP post request form? - 10/14/2003 10:09:59
Cool beans! I think a session variable will work nicely here. Okay, I'm going on the assumption that you're using the POST method in your form on 1.asp. Try making this your first line of ASP code in insert.asp: quote:
Session("customer_id") = Request.Form("customer_id") (Note: if you're actually using the GET method in your form on 1.asp, just change the Request.Form part to Request.Querystring.) Now all you need to do is pop open 2.asp and find the customer_id form tag there. We need the value of that tag to be the same as the value we stuffed into Session("customer_id") on our insert.asp page. You mentioned that you didn't want the person to have to retype it, so I'm going on the assumption that the customer_id field on 2.asp is a text field. Try something like this: quote:
<input type="text" name="customer_id" value="<%=Response.Write(Session("customer_id"))%>" /> Be very careful to get all that fun syntax stuff right. That's a common problem people run into. Anyway, that ought to do it. :)
_____________________________
"You can only be a victim if you admit defeat." -Descendents
|
|
|
|
Light
Posts: 199 Joined: 3/28/2002 From: Earth Status: offline
|
RE: Can ASP post request form? - 10/14/2003 13:18:42
Thanks a lot chasta I will try it and let you know the result, thanks again
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|