dtolo
asked on
Query String from url into variables
I need to store the results of a url querystring into variables
I get the results
<%=Request.QueryString("Cl assName") %>
<%=Request.QueryString("Da ysAndTimes ") %>
Just fine. Now i need to combine them with a record set drawn from a SQL table, and pop them into another one.
The problem is that when I select the db record the page refreshes and I loose my url query string.
So I'm thinking that after I get my url querystring I should pop them into variable right away so that I dont loose the url querystring. Then I'll be able to use the values..
How does that sound?
How do I do it?
Thanks
~David
I get the results
<%=Request.QueryString("Cl
<%=Request.QueryString("Da
Just fine. Now i need to combine them with a record set drawn from a SQL table, and pop them into another one.
The problem is that when I select the db record the page refreshes and I loose my url query string.
So I'm thinking that after I get my url querystring I should pop them into variable right away so that I dont loose the url querystring. Then I'll be able to use the values..
How does that sound?
How do I do it?
Thanks
~David
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
your suggestion sounds like it could work, although there are easier / different ways to do this. What I understand to be your problem is that the user has done a search (let me know if this isn't the case) on Class Name and / or Days and Times. When you display the results, the user can click a record. When the user clicks a record, you're just redirecting to some other page, and you lose the search criteria. Before I go too much further, are these assumptions correct?
if this is the case, just putting them into variables isn't going to persist them through round trips to the server, as you probably know. I really like the method dwaldner uses, though -- the eval() command isn't used enough in asp.
At any rate, without storing the criteria in session variables for every user and every search, you'd have to keep passing around the querystring, or posting hidden form values. I suppose you could serialize the values to a db for later retrieval...it's all based on how you want to do it.
If you give me more information about this application, I can suggest an easy approach.
At any rate, without storing the criteria in session variables for every user and every search, you'd have to keep passing around the querystring, or posting hidden form values. I suppose you could serialize the values to a db for later retrieval...it's all based on how you want to do it.
If you give me more information about this application, I can suggest an easy approach.
just take the value of the querystring and pop it into a hidden field in a form. That way everytime the page is reloaded, the form hidden field still has that variable waiting for you.
ASKER
Peh803
it is actually a link on a calendar that takes the ClassName DaysAndTimes Fields and passes them to another page that is connected to a SQL db that the user can select his employee number from, make his record active, then choose to add himself plus the classname and daysandtimes value to a register table.
dwaldner this sounds good!
I am a beginer so you are going to have to break it down for me. what are the Variable Names for ClassName and DaysAndTimes going to be once they are generated from this routine?
it is actually a link on a calendar that takes the ClassName DaysAndTimes Fields and passes them to another page that is connected to a SQL db that the user can select his employee number from, make his record active, then choose to add himself plus the classname and daysandtimes value to a register table.
dwaldner this sounds good!
I am a beginer so you are going to have to break it down for me. what are the Variable Names for ClassName and DaysAndTimes going to be once they are generated from this routine?
I would store the query strings into hidden form fields.
So your <form> on the page needs hidden fields for every parameter value you like to store and your ASP needs to overwrite the values of those fields only if the query string parameters are present.
Do you need an example?
So your <form> on the page needs hidden fields for every parameter value you like to store and your ASP needs to overwrite the values of those fields only if the query string parameters are present.
Do you need an example?
if keeping the same querystring when you submit the form is all you want, do this:
<form method="POST" action="page.asp?<%=reques t.querystr ing%>">
...
....
...
</form>
This will pass both the querystring AND the form data (I do this on a VERY regular basis).
Dan
<form method="POST" action="page.asp?<%=reques
...
....
...
</form>
This will pass both the querystring AND the form data (I do this on a VERY regular basis).
Dan
ASKER
Flow79 I tried that but it didn't work
Ok, Dan's idea is better :)
well, show me your code so that i can see why it isnt working, because it will (i do it all the time) - you just have to code it properly
If you want the values to be available in all future pages simply add them to the seesion variables collection.
eg.
<%
Session ("ClassName") = Request.QueryString("Class Name")
Session ("DaysAndTimes") = Request.QueryString("DaysA ndTimes")
%>
Regards.
eg.
<%
Session ("ClassName") = Request.QueryString("Class
Session ("DaysAndTimes") = Request.QueryString("DaysA
%>
Regards.
@dtolo
From the routine that I gave you (the for loop), that will take the querystring variable and make it a page variable, so rather than typing in Request.Querystring("foo1" ) you can simply type in foo1 to access the information from the querystring.
If you need anything else, just post...
Dan
From the routine that I gave you (the for loop), that will take the querystring variable and make it a page variable, so rather than typing in Request.Querystring("foo1"
If you need anything else, just post...
Dan
Watch putting the contents of the variable into a session variable...while it is an easy fix to the problem you're having, it will put a LOT of unnecessary strain on your server if your site is a popular one.
If you use the Session Object to retrieve the values in future pages: <% Response.Write (Session("Variablename")) %>
To amend the value: <% Session("Variablename") = <AnotherVariable/Value> %>
To Destroy the Session (Clear all session variables): Session.Abandon()
Regards.
To amend the value: <% Session("Variablename") = <AnotherVariable/Value> %>
To Destroy the Session (Clear all session variables): Session.Abandon()
Regards.
Maybe you should have them choose everything on the first page. ClassName, DaysAndTimes, and employee#.
I agree with posters who are against overuse of the session...probably not necessary in this case.
One obvious limitation to putting the querystring in the form's action is that for any redirection you want to do, you have to post the form. That said, it's a great method -- I do use this method a lot.
It's either that, or if you want to redirect manually (using an <a> tag, etc), you'll have to append the querystring to each href.
Make sense? So, as long as you do this to all forms:
<form action="thispage.asp?<%=re quest.quer ystring%>"
and this to all links:
<a href="nextPage.asp?<%=requ eset.query string%>"> go to next page</a>
you should never have to worry about losing your querystring. Using a function to build the links with the querystring added on might be useful to you as well.
Regards,
peh803
One obvious limitation to putting the querystring in the form's action is that for any redirection you want to do, you have to post the form. That said, it's a great method -- I do use this method a lot.
It's either that, or if you want to redirect manually (using an <a> tag, etc), you'll have to append the querystring to each href.
Make sense? So, as long as you do this to all forms:
<form action="thispage.asp?<%=re
and this to all links:
<a href="nextPage.asp?<%=requ
you should never have to worry about losing your querystring. Using a function to build the links with the querystring added on might be useful to you as well.
Regards,
peh803
such a function might look like this:
function getQSLink(sUrl, sLabel, sOtherLinkAttributes)
'sOtherLinkAttributes would be used for any class declarations for your link, id attrubutes, in-line style declarations, etc.
Dim sRetVal, sQSAdder
sQSAdder = "?"
if instr(sUrl, "?")>0 then
'if user is passing a link to this function with a querystring already in it, we want to use an ampersand instead of a ?
sQSAdder = "&"
end if
sQSAdder = sQSAdder & request.querystring
sRetVal = "<a href="""&uUrl&sQSAdder&" "&sOtherLinkAttributes&">" &sLabel&"< /a>"
getQSLink = sRetVal
end function
You could call it like this:
<%=getQSLink("NextPage.asp ", "Go To The Next Page!!", "style=""font-weight:bold; text-decor ation:none ;font-fami ly:helveti ca""")%>
regards,
peh803
function getQSLink(sUrl, sLabel, sOtherLinkAttributes)
'sOtherLinkAttributes would be used for any class declarations for your link, id attrubutes, in-line style declarations, etc.
Dim sRetVal, sQSAdder
sQSAdder = "?"
if instr(sUrl, "?")>0 then
'if user is passing a link to this function with a querystring already in it, we want to use an ampersand instead of a ?
sQSAdder = "&"
end if
sQSAdder = sQSAdder & request.querystring
sRetVal = "<a href="""&uUrl&sQSAdder&" "&sOtherLinkAttributes&">"
getQSLink = sRetVal
end function
You could call it like this:
<%=getQSLink("NextPage.asp
regards,
peh803
ASKER
Man you guys have a lot of great Ideas. It's going to take me a while to sort this all out and figure out who to award points to. I'm a little emabarrased to post my code because it's in front page and will probably loose you (it's kind of proprietary)
Judging from what you guys said it should work and I can't see why it doesn't I have a lot more to go on now. I grabed a query parser that's in the head of the first page, it has to be very easy for my end users to create the URL.
Any way the user would clisk on a url that looks something like. http://zeusdev/cssd/prototype/ta/default.asp?ClassName=Handcuff Training&DaysAndTimes=0802 22004"
That will take them to a page that looks like this:
<html>
<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Register For Class</title>
<script Language="JavaScript">
//
// QueryString
//
function QueryString(key)
{
var value = null;
for (var i=0;i<QueryString.keys.len gth;i++)
{
if (QueryString.keys[i]==key)
{
value = QueryString.values[i];
break;
}
}
return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();
function QueryString_Parse()
{
var query = window.location.search.sub string(1);
var pairs = query.split("&");
for (var i=0;i<pairs.length;i++)
{
var pos = pairs[i].indexOf('=');
if (pos >= 0)
{
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
QueryString.keys[QueryStri ng.keys.le ngth] = argname;
QueryString.values[QuerySt ring.value s.length] = value;
}
}
}
QueryString_Parse();
</script>
</head>
<body>
<% If request("Submit") <> "" Then %>
<table>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,E mployeeNum ber,FirstN ame,LastNa me,Address ,City,Stat eOrProvinc e,PostalCo de,PhoneNu mber,Major ,Email,Thi rdName,Fou rthName,Ad dress1,Add ress2,Town ,State,Zip ,PhoneExte nsion" s-columntypes="3,202,200,2 00,200,202 ,202,202,2 02,202,200 ,200,200,2 00,200,200 ,200,200,2 00" s-dataconnection="TA-UPDAT E" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Students" s-displaycolumns="Employee Number" s-criteria="[EmployeeNumbe r] EQ {EmployeeNumber} +" s-order s-sql="SELECT * FROM Students WHERE (EmployeeNumber = '::EmployeeNumber::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="EmployeeN umber=" s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdbl ib.inc" u-dbrgn1="../_fpclass/fpdb rgn1.inc" u-dbrgn2="../_fpclass/fpdb rgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" ; width="100%"> <font color="#000000"& gt;This is the start of a Database Results region.</font></t d></ tr>" startspan --><!--#include file="../_fpclass/fpdblib. inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students WHERE (EmployeeNumber = '::EmployeeNumber::')"
fp_sDefault="EmployeeNumbe r="
fp_sNoRecords="<tr><td colspan=1 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&StudentID=3 &EmployeeN umber=202& FirstName= 200&LastNa me=200&Add ress=200&C ity=202&St ateOrProvi nce=202&Po stalCode=2 02&PhoneNu mber=202&M ajor=202&E mail=200&T hirdName=2 00&FourthN ame=200&Ad dress1=200 &Address2= 200&Town=2 00&State=2 00&Zip=200 &PhoneExte nsion=200& "
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1 .inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="50921" -->
<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
<tr>
<td width="50%">Last Name</td>
<td width="50%"><%=fp_rs("Last Name")%></ td>
</tr>
<tr>
<td width="50%">First Name
<td width="50%"><%=fp_rs("Firs tName")%>< /td>
</tr>
<tr>
<td width="50%">Employee Number
<td width="50%"><%=fp_rs("Empl oyeeNumber ")%></td>
</tr>
<tr>
<td width="50%">Email Address
<td width="50%"><%=fp_rs("Emai l")%></td>
</tr>
<tr>
<td width="50%">Class Name
<td width="50%"><%=Request.Que ryString(" ClassName" ) %></td>
</tr>
<tr>
<td width="50%">Date
<td width="50%"><%=Request.Que ryString(" DaysAndTim es") %></td>
</tr>
<tr>
<td width="100%" colspan="2" align="center">Is this information correct?</td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdb rgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" ; width="100%"> <font color="#000000"& gt;This is the end of a Database Results region.</font></t d></ tr>" startspan --><!--#include file="../_fpclass/fpdbrgn2 .inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<table align="center">
<tr>
<td>
<form action="page3.asp">
<input type="hidden" value="<%=varLname%>" name="LastName">
<input type="hidden" value="<%=varFname%>" name="FirstName">
<input type="hidden" value="<%=varEmpNum%>" name="EmployeeNumber">
<input type="hidden" value="<%=varEmail%>" name="Email">
<input type="hidden" value="<%=request.querystr ing("Class Name")%>"
name="ClassName">
<input type="hidden" value="<%= request.querystring("Dates AndTimes") %>"
name="DateAndTime">
<input type="submit" value="Yes - Continue With Registraton"
name="SubmitReg">
</form>
</td>
<td>
<form action="javascript:history .go(-1)">
<input type="submit" value="No - Return to Selection Form" name="Return">
</form>
</td>
</tr>
</table>
<% Else %>
<form
action="default.asp?ClassN ame=<%=req uest.query string("Cl assName")% >&DateAndT
ime=<%=request.querystring ("DateAndT ime")%>">
<nobr>
<!--webbot bot="DatabaseRegionStart" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,Email" s-columntypes="202,200,200 ,200" s-dataconnection="TA-UPDAT E" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="EmployeeNumb er" s-menuvalue="EmployeeNumbe r" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="Employee Number,Fir stName,Las tName,Emai l" s-criteria s-order s-sql="SELECT EmployeeNumber, FirstName, LastName, Email<br>FROM Students<br>WHERE (EmployeeNumber IS NOT NULL) ORDER BY EmployeeNumber ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="1" u-dblib="../_fpclass/fpdbl ib.inc" u-dbrgn1="../_fpclass/fpdb rgn1.inc" u-dbrgn2="../_fpclass/fpdb rgn2.inc" preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Da tabase< /span> " startspan --><!--#include file="../_fpclass/fpdblib. inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT EmployeeNumber, FirstName, LastName, Email FROM Students WHERE (EmployeeNumber IS NOT NULL) ORDER BY EmployeeNumber ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="EmployeeNu mber"
fp_sMenuValue="EmployeeNum ber"
fp_sColTypes="&EmployeeNum ber=202&Fi rstName=20 0&LastName =200&Email =200&"
fp_iDisplayCols=4
fp_fCustomQuery=True
BOTID=1
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="26131" --><select NAME="EmployeeNumber" SIZE="1">
<!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpd brgn1.inc" startspan --><!--#include file="../_fpclass/fpdbrgn1 .inc"--><! --webbot bot="AspInclude" endspan i-checksum="52766" -->
<option><%=FP_FieldHTML(fp _rs,"Emplo yeeNumber" )%></optio n>
<!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpd brgn2.inc" startspan --><!--#include file="../_fpclass/fpdbrgn2 .inc"--><! --webbot bot="AspInclude" endspan i-checksum="52830" -->
</select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../_fpclass/fpdb rgn2.inc" i-groupsize="0" clientside preview=" <span style="color: rgb(0,0,0); background-color: rgb(255,255,0)">Re sults</ span> " startspan --><!--webbot bot="DatabaseRegionEnd" endspan -->
<input type="submit" value="Submit" name="Submit"></nobr></for m>
<% End if %>
</body>
</html>
This page runs a series of routines and then is supposed to post to send the data to the following page which adds a record to another table using the data from the url string + the employe table:
<html>
<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>You Have been registered for your class!</title>
</head>
<body>
<table>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes s-dataconnection="TA-UPDAT E" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns s-criteria s-order s-sql="INSERT INTO Register (LastName, FirstName, EmployeeNumber, Email, ClassName, DaysAndTimes) VALUES ('::LastName::', '::FirstName::', '::EmployeeNumber::', '::Email::', '::ClassName::', '::DaysAndTimes::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="LastName= &amp;F irstName=& amp;amp;Em ployeeNumb er=&am p;Email=&a mp;amp;Cla ssName=&am p;amp;Days AndTimes=" s-norecordsfound="You Have Succefully Registered For: " i-maxrecords="256" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdbl ib.inc" u-dbrgn1="../_fpclass/fpdb rgn1.inc" u-dbrgn2="../_fpclass/fpdb rgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" ; width="100%"> <font color="#000000"& gt;This is the start of a Database Results region.</font></t d></ tr>" startspan b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="TRUE" --><!--#include file="../_fpclass/fpdblib. inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="INSERT INTO Register (LastName, FirstName, EmployeeNumber, Email, ClassName, DaysAndTimes) VALUES ('::LastName::', '::FirstName::', '::EmployeeNumber::', '::Email::', '::ClassName::', '::DaysAndTimes::')"
fp_sDefault="LastName=&Fir stName=&Em ployeeNumb er=&Email= &ClassName =&DaysAndT imes="
fp_sNoRecords="<tr><td colspan=16 align=""LEFT"" width=""100%"">You Have Succefully Registered For: </td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1 .inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="43361" --><!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdb rgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" ; width="100%"> <font color="#000000"& gt;This is the end of a Database Results region.</font></t d></ tr>" startspan --><!--#include file="../_fpclass/fpdbrgn2 .inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<br><p><b>This is a list of Users Registered for this Class</b></p>
<table>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,ClassNa me,DaysAnd Times,Emai l" s-columntypes="200,202,202 ,202,135,2 02" s-dataconnection="TA-UPDAT E" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Register" s-displaycolumns="FirstNam e,LastName ,EmployeeN umber,Emai l,ClassNam e,DaysAndT imes" s-criteria s-order="[LastName] + [FirstName] +" s-sql="SELECT * FROM Register ORDER BY LastName ASC,FirstName ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="1" u-dblib="../_fpclass/fpdbl ib.inc" u-dbrgn1="../_fpclass/fpdb rgn1.inc" u-dbrgn2="../_fpclass/fpdb rgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" ; width="100%"> <font color="#000000"& gt;This is the start of a Database Results region.</font></t d></ tr>" startspan --><!--#include file="../_fpclass/fpdblib. inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Register ORDER BY LastName ASC,FirstName ASC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&EmployeeNum ber=200&Fi rstName=20 2&LastName =202&Class Name=202&D aysAndTime s=135&Emai l=202&"
fp_iDisplayCols=6
fp_fCustomQuery=False
BOTID=1
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1 .inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="34063" --><tr>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,ClassNa me,DaysAnd Times,Emai l" s-column="FirstName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&am p;lt;& lt;</fo nt>Firs tName<f ont size="-1">&am p;gt;& gt;</fo nt>" startspan --><%=FP_FieldVal(fp_rs,"F irstName") %><!--webb ot bot="DatabaseResultColumn" endspan i-checksum="18712" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,ClassNa me,DaysAnd Times,Emai l" s-column="LastName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&am p;lt;& lt;</fo nt>Last Name<fo nt size="-1">&am p;gt;& gt;</fo nt>" startspan --><%=FP_FieldVal(fp_rs,"L astName")% ><!--webbo t bot="DatabaseResultColumn" endspan i-checksum="14417" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,ClassNa me,DaysAnd Times,Emai l" s-column="EmployeeNumber" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&am p;lt;& lt;</fo nt>Empl oyeeNumber <font size="-1">&am p;gt;& gt;</fo nt>" startspan --><%=FP_FieldVal(fp_rs,"E mployeeNum ber")%><!- -webbot bot="DatabaseResultColumn" endspan i-checksum="41846" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,ClassNa me,DaysAnd Times,Emai l" s-column="Email" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&am p;lt;& lt;</fo nt>Emai l<font size="-1">&am p;gt;& gt;</fo nt>" startspan --><%=FP_FieldVal(fp_rs,"E mail")%><! --webbot bot="DatabaseResultColumn" endspan i-checksum="8328" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,ClassNa me,DaysAnd Times,Emai l" s-column="ClassName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&am p;lt;& lt;</fo nt>Clas sName<f ont size="-1">&am p;gt;& gt;</fo nt>" startspan --><%=FP_FieldVal(fp_rs,"C lassName") %><!--webb ot bot="DatabaseResultColumn" endspan i-checksum="18883" --></td>
<td>
<!--webbot bot="DatabaseResultColumn" s-columnnames="EmployeeNum ber,FirstN ame,LastNa me,ClassNa me,DaysAnd Times,Emai l" s-column="DaysAndTimes" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1">&am p;lt;& lt;</fo nt>Days AndTimes&l t;font size="-1">&am p;gt;& gt;</fo nt>" startspan --><%=FP_FieldVal(fp_rs,"D aysAndTime s")%><!--w ebbot bot="DatabaseResultColumn" endspan i-checksum="29731" --></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdb rgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" ; width="100%"> <font color="#000000"& gt;This is the end of a Database Results region.</font></t d></ tr>" startspan --><!--#include file="../_fpclass/fpdbrgn2 .inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
</body>
</html>
Good luck making heads or tails of this. It took me quite a while.
~David
Judging from what you guys said it should work and I can't see why it doesn't I have a lot more to go on now. I grabed a query parser that's in the head of the first page, it has to be very easy for my end users to create the URL.
Any way the user would clisk on a url that looks something like. http://zeusdev/cssd/prototype/ta/default.asp?ClassName=Handcuff Training&DaysAndTimes=0802
That will take them to a page that looks like this:
<html>
<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Register For Class</title>
<script Language="JavaScript">
//
// QueryString
//
function QueryString(key)
{
var value = null;
for (var i=0;i<QueryString.keys.len
{
if (QueryString.keys[i]==key)
{
value = QueryString.values[i];
break;
}
}
return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();
function QueryString_Parse()
{
var query = window.location.search.sub
var pairs = query.split("&");
for (var i=0;i<pairs.length;i++)
{
var pos = pairs[i].indexOf('=');
if (pos >= 0)
{
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
QueryString.keys[QueryStri
QueryString.values[QuerySt
}
}
}
QueryString_Parse();
</script>
</head>
<body>
<% If request("Submit") <> "" Then %>
<table>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,E
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students WHERE (EmployeeNumber = '::EmployeeNumber::')"
fp_sDefault="EmployeeNumbe
fp_sNoRecords="<tr><td colspan=1 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&StudentID=3
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="50921" -->
<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
<tr>
<td width="50%">Last Name</td>
<td width="50%"><%=fp_rs("Last
</tr>
<tr>
<td width="50%">First Name
<td width="50%"><%=fp_rs("Firs
</tr>
<tr>
<td width="50%">Employee Number
<td width="50%"><%=fp_rs("Empl
</tr>
<tr>
<td width="50%">Email Address
<td width="50%"><%=fp_rs("Emai
</tr>
<tr>
<td width="50%">Class Name
<td width="50%"><%=Request.Que
</tr>
<tr>
<td width="50%">Date
<td width="50%"><%=Request.Que
</tr>
<tr>
<td width="100%" colspan="2" align="center">Is this information correct?</td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdb
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<table align="center">
<tr>
<td>
<form action="page3.asp">
<input type="hidden" value="<%=varLname%>" name="LastName">
<input type="hidden" value="<%=varFname%>" name="FirstName">
<input type="hidden" value="<%=varEmpNum%>" name="EmployeeNumber">
<input type="hidden" value="<%=varEmail%>" name="Email">
<input type="hidden" value="<%=request.querystr
name="ClassName">
<input type="hidden" value="<%= request.querystring("Dates
name="DateAndTime">
<input type="submit" value="Yes - Continue With Registraton"
name="SubmitReg">
</form>
</td>
<td>
<form action="javascript:history
<input type="submit" value="No - Return to Selection Form" name="Return">
</form>
</td>
</tr>
</table>
<% Else %>
<form
action="default.asp?ClassN
ime=<%=request.querystring
<nobr>
<!--webbot bot="DatabaseRegionStart" s-columnnames="EmployeeNum
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT EmployeeNumber, FirstName, LastName, Email FROM Students WHERE (EmployeeNumber IS NOT NULL) ORDER BY EmployeeNumber ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="EmployeeNu
fp_sMenuValue="EmployeeNum
fp_sColTypes="&EmployeeNum
fp_iDisplayCols=4
fp_fCustomQuery=True
BOTID=1
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="26131" --><select NAME="EmployeeNumber" SIZE="1">
<!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpd
<option><%=FP_FieldHTML(fp
<!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpd
</select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../_fpclass/fpdb
<input type="submit" value="Submit" name="Submit"></nobr></for
<% End if %>
</body>
</html>
This page runs a series of routines and then is supposed to post to send the data to the following page which adds a record to another table using the data from the url string + the employe table:
<html>
<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>You Have been registered for your class!</title>
</head>
<body>
<table>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes s-dataconnection="TA-UPDAT
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="INSERT INTO Register (LastName, FirstName, EmployeeNumber, Email, ClassName, DaysAndTimes) VALUES ('::LastName::', '::FirstName::', '::EmployeeNumber::', '::Email::', '::ClassName::', '::DaysAndTimes::')"
fp_sDefault="LastName=&Fir
fp_sNoRecords="<tr><td colspan=16 align=""LEFT"" width=""100%"">You Have Succefully Registered For: </td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="43361" --><!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdb
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<br><p><b>This is a list of Users Registered for this Class</b></p>
<table>
<tbody>
<!--webbot bot="DatabaseRegionStart" s-columnnames="EmployeeNum
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Register ORDER BY LastName ASC,FirstName ASC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&EmployeeNum
fp_iDisplayCols=6
fp_fCustomQuery=False
BOTID=1
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="34063" --><tr>
<td>
<!--webbot bot="DatabaseResultColumn"
<td>
<!--webbot bot="DatabaseResultColumn"
<td>
<!--webbot bot="DatabaseResultColumn"
<td>
<!--webbot bot="DatabaseResultColumn"
<td>
<!--webbot bot="DatabaseResultColumn"
<td>
<!--webbot bot="DatabaseResultColumn"
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdb
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
</body>
</html>
Good luck making heads or tails of this. It took me quite a while.
~David
haha....digging through all this code reminds me of one of the best movies of all times:
yeah....did you get the memo? It's just that we're putting coversheets on all our TPS reports........
oh, oh! And I almost forgot...I'm gonna need you to come in on Sunday, too. Yeah....we lost some people and we need to play catch up.....
At any rate, see if you can implement the suggestions of the posts here in this question, and award points to whoever you feel deserves the points based on the ideas you use.
yeah....did you get the memo? It's just that we're putting coversheets on all our TPS reports........
oh, oh! And I almost forgot...I'm gonna need you to come in on Sunday, too. Yeah....we lost some people and we need to play catch up.....
At any rate, see if you can implement the suggestions of the posts here in this question, and award points to whoever you feel deserves the points based on the ideas you use.
Yikes! Don't worry about FP, though. I'm sure we've all started there...
PC load letter....PC load letter...
if youre looking to get out of FP - i would suggest using HTML-Kit from Chami (Its Free).
You can download it at: http://www.chami.com/html-kit/download/
You can download it at: http://www.chami.com/html-kit/download/
what the **** does PC load letter mean?!?!?!
yeah -- html kit rocks... Of course, if you have access to it, the VS.NET 2003 development environment is pretty sweet too. Of course, it's not quite "free". :)
ok people - youre ruining an AMAZING movie!
the quote is: "PC load letter...what the **** does that mean?"
the full script can be found at: http://blake.prohosting.com/bamzone/office_space_transcript.html
the quote is: "PC load letter...what the **** does that mean?"
the full script can be found at: http://blake.prohosting.com/bamzone/office_space_transcript.html
lol...or the best of all time, the very first scene where Michael Bolton is in traffic singing Gangsta Rap, and he turns it down because there's a black guy selling flowers!!!!! ROFL...
Anyways, back to topic, again, just struggle through the code, see what works, and award points to whoever you've used...
Dan
Anyways, back to topic, again, just struggle through the code, see what works, and award points to whoever you've used...
Dan
"Michael...Bolton??? Are you any relation to the pop singer??"
okay, I'll stop now. I just had to get that off my chest.
okay, I'll stop now. I just had to get that off my chest.
ASKER
*lol*You guys are killing me...
I loved office space My favorite part is when the guy is listening to gangsta rap and when he sees the black guy selling flowers he locks the car door.
flow79
you said just take the value of the querystring and pop it into a hidden field in a form. That way everytime the page is reloaded, the form hidden field still has that variable waiting for you.
How can I tell if the form is actually storing the the query string in the hidden field? That is what I'm using.
When I put this in my page
<%=Request.QueryString("Cl assName") %>
<%=Request.QueryString("Da ysAndTimes ") %>
I can see the values at brows time. When i select my dbase record they disapear so i don't think the ever make it into the form.
~David
I loved office space My favorite part is when the guy is listening to gangsta rap and when he sees the black guy selling flowers he locks the car door.
flow79
you said just take the value of the querystring and pop it into a hidden field in a form. That way everytime the page is reloaded, the form hidden field still has that variable waiting for you.
How can I tell if the form is actually storing the the query string in the hidden field? That is what I'm using.
When I put this in my page
<%=Request.QueryString("Cl
<%=Request.QueryString("Da
I can see the values at brows time. When i select my dbase record they disapear so i don't think the ever make it into the form.
~David
a very quick implementation of what I was talking about is:
<%
var1 = "Hello World!"
'var1 = Request.QueryString("var1" )
%>
<form method="get" action="yourasp.asp">
<input type="hidden" name="yourhiddenfield" value="<%= var1 %>">
<input type="submit" value="Submit">
</form>
<% response.write var1 %>
for your uses, you would uncomment the var1 = Request.QueryString("var1" ), and get rid of var1 = "Hello World!"
<%
var1 = "Hello World!"
'var1 = Request.QueryString("var1"
%>
<form method="get" action="yourasp.asp">
<input type="hidden" name="yourhiddenfield" value="<%= var1 %>">
<input type="submit" value="Submit">
</form>
<% response.write var1 %>
for your uses, you would uncomment the var1 = Request.QueryString("var1"
the only way the value in the form field will be persisted is if the form field itself is actually posted back to the server. If the form is not posted, and rather the user "clicks the dbase record" as you've been calling it, that's when you would have to use the querystring appending function (or some similar method) that I mentioned earlier this post...
Hi,
Why dont u think of doing this way.
Upon reaching the search page, take the query string collections and put that into a dictionary object and assign it to sesssion variable.
Then from any other page you can simply assign back the session dictionary object collection to a variable n you can use it on current page where ever it is required.
This way only thing that you need to worry about is clearing and re-setting of value for dictionary objects collection in the session variable upon every fresh search.
I hope u know how to manupulate code with Dictionary object collections.
Simple example
Set dctQueryStrings = server.createobject("scrip ting.dicti onary")
for each item in request.querystring
dctQueryStrings.Add item,request.querystring(i tem)
next
Session("dctQueryString") = dctQueryStrings
You can assign this Session("dctQueryString") to any one variables like this on the other page
dctQueryStrings = Session("dctQueryString")
Then you can use the vaues like
dctQueryStrings.Item(0).va lue
I'm sure this will be a one stop solution to ur problem
Thanks & Rgds
Sara
Why dont u think of doing this way.
Upon reaching the search page, take the query string collections and put that into a dictionary object and assign it to sesssion variable.
Then from any other page you can simply assign back the session dictionary object collection to a variable n you can use it on current page where ever it is required.
This way only thing that you need to worry about is clearing and re-setting of value for dictionary objects collection in the session variable upon every fresh search.
I hope u know how to manupulate code with Dictionary object collections.
Simple example
Set dctQueryStrings = server.createobject("scrip
for each item in request.querystring
dctQueryStrings.Add item,request.querystring(i
next
Session("dctQueryString") = dctQueryStrings
You can assign this Session("dctQueryString") to any one variables like this on the other page
dctQueryStrings = Session("dctQueryString")
Then you can use the vaues like
dctQueryStrings.Item(0).va
I'm sure this will be a one stop solution to ur problem
Thanks & Rgds
Sara
I see it used a lot with but storing the dictionary object in a session variable will cause thread locking and limit scalability.