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!

Passing Data between pages after Inserting into DB 2

Status
Not open for further replies.

kelfuego

MIS
Jun 5, 2002
74
US
So I'm having difficulties passing data to another page after submitting form data into my database as a new record. Basically I'm building a purchase order system for staff to enter their purchases into. After creating a new PO (inserting into db) I want to goto a detail page that displays the PO number for the user to see.

Problem is that I am using auto number as the invoice number. So until the data is submitted the Invoice number is unknown. I have created an additional field which upon submittal recieves a GUID but I'm still not sure how to pass that number to my detail page.

Presently I'm using the post method on my main page to send to the detail page.

Kelly Johnson MCP
Central City Concern
 
If you are inserting a user id against the PO you could select Max autonumber where user = userID or along those lines.

Cheech

[Peace][Pipe]
 
That's an interesting Idea, and one that I'll think about in the future definately, but the problem I'm having is getting my submit button to perform more than one action.

Right now when clicked it submits the data to the database (including a unique text field). Once the insert is done it goes to a detail page. Unfortunately I don't believe I have any data passing from the base form page to the detail page.

So my question is more how do I both insert a new entry into my database, and pass data to the detail page with one button.



Kelly Johnson MCP
Central City Concern
 

First, what makes you think there is no data being passed, secondly, how do you capture the data from the form to submit to the DB?

Data doesn{t automatically pass over to pages without getting submmited or geting mannualy passed.

So if you have 3 pages:

form page,

db insert page

detail page

And you submit from "form" to "db insert" and then redirect to "detail", it will not get passed that far, you have to get it, in db insert page and send it to detail page.

However without knowing what language it is your are using to do this, i cannot go any further.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
vacunita,

I'm using dreamweaver, and ASP script. I am not a programmer and I'm doing the best I can to explain what my issue is so please be patient.

I have a form page that I have created and have used the built in server behaviors (insert) to create the record in my SQL db.

At the point that the submit button is clicked the data in the form is sent to the db and the the user is sent to the detail page (after inserting data, goto :)

Typically I would use a get statement so that I can see a particular field sent through the URL, but post apparently is required by Dreamweaver.

So technically I do not know if data is being passed to the redirect page or not---what I do know is that I am not getting any response from the detail page by displaying the data recieved.

I have a unique field that I want to be able to use on the detail page to retrieve the record so that I can display the Purchase Order number assigned upon submission.



Kelly Johnson MCP
Central City Concern
 
O.k., i'm not too familiar with ASP. But I believe the Request statement can be used to retrieve both GET and POST values. Once You have those values you should be able to passem through to the detail page.

Someone here is sure to be able to help you with the finer points of ASP. But the basic concept holds true for any language. You need to capture the values in the processing page, and pass them over to the display page.

In PHP you could append them to the URL as i mentioned something like: [var...
And then redirect.
I bet there is a similar method for ASP.







----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Yep basic principle is the same. Except dont submit the details into the database on the same page as the form. Submit to a page that captures all of the data and assigns it to variables then insert those into the database and pass them then to your details page.

[Peace][Pipe]
 
Thank you to the both of you, you've both been very helpful.

Kelly Johnson MCP
Central City Concern
 
You are most welcome . Glad you sorted it out.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Actually you two sorted it out for me. I still have to try and implement it for me, but you all have given me a little shove in the right direction.

If either of you could recommend a good source or two for both php and asp tutorials I would greatly appreciate that as well.

Learning new skills is fun, but frustrating when your trying to apply it to a real world situation at the same time.


Kelly Johnson MCP
Central City Concern
 
Well Don't know about ASP, But php.net's online manual, has a lot of info on functions and how to implement things.

As for books: Beginning PHP 5 and MySQL: From Novice to Professional. by W. J. Gilmore, is pretty good. And shows the ropes of PHP and mysql.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Hi Kelly

I'm no great expert on this but I have just been learning about passing parameters from one web page to another (in a chapter in my Coldfusion book).
Once you have got the PO number (Cheech's solution is
excellent) you could
1)Pass this number to the target page via a URL param
eg. 2) Or use a cookie (but risky as many users block them)
3) Use post method as you say!

hope that helps

R21
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top