Responses interspersed...
"Dave" <
[email protected]> wrote in message
Thanks Jim:
I need a little more info: I use the example
Ex1
a href="courseinfo.asp?course=<%=rs("Course")%>">Course Info</a> to pass one
value now.
What would be the syntax to pass 2 values (Course and Start Date)?
Well, you need to create a URL like
courseinfo.asp?course=math101&stdate=20040731
so the code would be
response.redirect "courseinfo.asp?course=" & tmpCourse & _
"&stdate=" & tmpstdate
If, however, your start date contains slashes or other reserved
characters, you would need to code:
response.redirect "courseinfo.asp?course=" & tmpCourse & _
"&stdate=" & server.urlencode(tmpstdate)
The server.urlencode methods translats / to %2F and so forth. ASP
translates these back to / and so forth on input.
Ex2
The Response.Redirect example: response.redirect "courseinfo.asp?course=" &
tmpCourse
This is similar to Ex1 and I know how to redirect, but not how to pass 2
values.
Same as above.
Can the recordset value be sent in a hidden form field, and if so how?
Can you help a little more?
Dave
If you have
<form method="POST" action="courseinfo.asp">
<input type="hidden" name="course">
<input type="hidden" name="stdate">
...
</form>
then you would have to write a script like:
<script>
function subForm(course, stdate){
document.forms[0].course.value=course;
document.forms[0].stdate.value=stdate;
document.forms[0].submit();
}
</script>
And then invoke the script by sending code to the browser, as in:
tmpCourse = ""
if not rs.eof then
tmpcourse = rs("course")
tmpstdate = rs("stdate")
end if
rs.close
cn.close
if tmpCourse <> "" then
response.write "<script>subForm('" & tmpcourse & _
"','" & tmpstdate & "');</script>"
end if
The courseinfo.asp page would then receive the values in
Request.Form("course") and Request.Form("stdate")
However, why would you go to this extra trouble? True, with the hidden
form fields, the visitor doesn't see the query string values in the
Address bar. But don't those values appear on the selection page, the
query page, or both anyway? It doesn't seem like they'd be a big
secret. And the visitor could see them anyway, by doing a View Source.
Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------