Link to home
Start Free TrialLog in
Avatar of saragose
saragose

asked on

Classic ASP and parent forms

Hey there,
I've writing a small piece of code, where on one page I choose a date, click a button and on the pop-up, I show all courses available for that date. I'm having trouble with the page showing the courses. I can't seem to make the child form read anything from the parent form. I've found how to do it through HTML, but since it will be affecting the sql, I need to do it in the asp, before the second form is fully created. Is there a way with something like a request object, or do I have to use a session object?

Thanks
Eric
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

you need to have a Request.Querystring

Something like this:

(This in your Forms action)
childpage.asp?id=1  (of what every you need to show the records)

In the child page.
You will have your database SELECT statement like so:

getPage = Request.QueryString("id")
sql = "SELECT field1, field2, field3 FROM Table1 WHERE "& getPage & ""

(Body of page)
Read your records here.

That is it.
If you need an example code of this procedure, please provide your Table Structure
And I will be glad to make up one for you

Carrzkiss
carrzkiss is right but just a note that the sql statement isn't quite correct.  It should be more like:
sql = "SELECT field1, field2, field3 FROM Table1 WHERE column1 = " & getPage
Also this is susceptable to SQL injection attacks so you need to code defensiveley:
http://en.wikipedia.org/wiki/SQL_injection
 
Avatar of saragose
saragose

ASKER

That's really useful.

But my issue now, is to send data back to the parent page. I wanted to use the child page to populate fields on the parent field based on what they click. I assume that I can do this with Javascript?

Thanks
Eric
opps.
Forgot that part.
Sometimes writing fast can forget code .... Sorry about that.
Good eye Dave
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
saragose:
Any progress in this issue?
Please keep us informed.

Carrzkiss
hey Eric.
You going to come in a finalize this post, or leave it hanging in limbo?
Time to finalize this one.
It has been way to long since you opened it and we assisted you with it.
Please come in and award points so this can be closed out.

Thank you
Carrzkiss