Forum Moderators: open

Message Too Old, No Replies

Is this code for passing info correct?

         

Blelisa

1:41 pm on Sep 21, 2005 (gmt 0)

10+ Year Member



I have a page that lists all of my records in a database. Each record is linked using <a href="details.asp?ID=<%= objRS("Tnum")%>">Ticket <%= objRS("Tnum") %></a>

I want when a visitor clicks on the link to go to a new page that shows all the records information.

The page that shows all the record information will be details.asp and I think the code would be something like:

myvariable=Request.QueryString("ID")

SELECT * FROM table WHERE columnheading=myvariable

Than my table for the output would look something like this:
<td><font face="Arial, Helvetica, sans-serif" size="1"><%=objRS("DateEntered")%></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%=objRS("BugDescription")%></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%=objRS("SimulatorsAffected")%></font></td>

Am I on the right track?

Also on the original page where it shows all my records and the link resides, where do I tell it to go to details.asp?

Thanks for your help

txbakers

2:00 pm on Sep 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



looks good so far. keep going on it.

The only other thing you have to anticipate is that people might go directly to the detail page without clicking - so the first query will fail. I usually give the variable that captures the QueryString a default value. Then, check if the QueryString exists and if so, set it to the variable.

Easy_Coder

2:40 pm on Sep 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might want to also validate this value before passing it:

myvariable= trim(Request.QueryString("ID")) & ""

if myvariable <> "" then
' good to go

And using * is a bad habit try using just the fields you need:

SELECT DateEntered, BugDescription, SimulatorsAffected, Tnum FROM table WHERE columnheading=myvariable