Form Results

S

Sproul

I have a form where i submit data to a database, but i would like to use some
of that data to send to another page, where i run another query, so rather
than retyping the data to submit again, can i have the data carry accross to
the other page and fill in a data field?

Is there a way i can create it as a "Session" variable.

The basics of what i want to do is, i have two databases (they have to be
seperate), one is for repairs and another is for "fault reporting", After
logging the Repair i want to the use the "equipment ID", to find the last
entry in the "fault reporting" database, at which point i update using the
Record ID to update the database.

Thanks
 
T

Thomas A. Rowe

To create a session variable do the following on the page the data is submitted to:

Session("variablename") = Request.Form("Fieldname")


--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
http://www.Ecom-Data.com
==============================================
 
S

Sproul

Thanks Thomas, unortunately that was one of the first things i tried, at the
top of the page i put
<% Session("EquipmentID") = Request.Form("EquipmentID") %>
then in the next page i put
<%=Session("EquipmentID")%>

There was nothing returned

Do i maybe need to put the form Name?

----------------------

I had thought of another way to do it, however it's only ok as a temporary
solution as it only works if one user is using that database at that time.
Redirect to another page which selects the last entry into the database(if
more than one user could cause problems) the "EquipmentID" form Field is
filled with the "EquipmentID" field of the query, but i'd like to autosubmit
that if it is possible

I tried putting ("Test" is the form name)

<%

If EquipmentID="" Then
Response.Write "There is nothing to declare"
Else
document.Test.submit()
End If

%>

But just got an error, i previously had

<%

If EquipmentID="" Then
Response.Write "There is nothing to declare"
Else
Response.Write EquipmentID
End If

%>


and that worked fine

Note: EquipmentID is defined when the field is returned from the database
---------------------------------------
If i can get the session("EquipmentID") to work that would be great

Just a thought can you have more than one session("whatever") runnng at a
time? as i have one for a UID, using a password protection thing i got from a
microsoft page.

Thanks again
 
T

Thomas A. Rowe

Ok, to define the session value after your query to the database, not at the top of the page.

<%
Session("EquipmentID") = RecordSetName("EquipmentID")
%>

RecordSetName - the name of your record set.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
http://www.Ecom-Data.com
==============================================
 
S

Sproul

I've managed to get something working, i think its similar to what you have
said, just done differently

After submitting the data i pull up the last entry in that database,
paste the returned database value that i require into a form field, then use
javascript to verify the data, then either redirect to the original page or
post the form to the next page.

if going to the next page the new data is posted into the required fields
and posted to an update form.

i think i have one more page in there than i require so i will modify to
remove an unneccessary page.


i could not get the Session("whatever") thing working from the original
database post page, but i can get it to work on all other pages,
unfortunately even though i could get it to work on the other pages i
couldn't use it to do a database query.

The way i have it working now is fine except for the one loophole where if
two or more people use the database the last entry for that database may not
be the one that the user entered.

so it can work just that i might get the wrong data on occasion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top