|
lu lu -> RE: url encode asp (2/9/2002 14:45:54)
|
If i use response.write i get this: fname=john&lname=smith which is correct but (and i'm not sure if this is a problem) the browser url has: ?appID=2&slct=1 in it. When the pdf opens the pdf opening screen has appID=2&slct=1 What i assume is happening is the msg=" " is not writing to the url encoded but appID=2&slct=1 is. (i just created a pdf with field appID and field slct and it was populated with values 2 & 1 respectivly. Fo some reason (unkonwn to me) the appID and slct values are being transfered to the test.pdf... not teh db field names and values. If you seen the reason why this might be happening could you PLEASE let me know. <%@ Language=VBScript %> <% Response.Buffer = true%> <% slct = CInt(Request("slct")) appID = CInt(Request("appID")) If appID<> "" Then Set connDB = Server.CreateObject("ADODB.Connection") connDB.Open "DBQ=" & Server.MapPath("..\employsolca\database.mdb") & ";" & _ "DRIVER=Microsoft Access Driver (*.mdb)" sql = "SELECT appID FROM table1" Set RS = connDB.Execute(sql) End If %> <html> <head> </head> <body> <form> <select size="1" name="appID"> <%While Not RS.EOF%> <option value="<%=RS("appID")%>">Applicant ID > ><%=RS.Fields("appID")%></option> <% RS.MoveNext Wend %> <option selected>select a client </select> <p><select size="1" name="slct"> <option selected value="0">select a form</option> <option value="1">test.pdf</option> </select></p> <p> <input type="submit"> </p> </form> <% Function determineForm() If slct = 1 Then determineForm = "test.pdf" : Exit Function End If End Function %> <% strResult = LCase(determineForm()) Select Case strResult %> <% Case "test.pdf" data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database.mdb") Set rs = Server.CreateObject("ADODB.Recordset") rs.Open "select * from table1 where (appID = " & appID & " )", data_source %> <form method="GET" action="test.pdf"> <% fname = Trim(rs("fname")) lname = Trim(rs("lname")) msg = "fname=" & Trim(rs("fname")) & "&lname=" & Trim(rs("lname")) Response.Redirect "test.pdf?msg=" & Server.URLEncode(msg) rs.Close Set rs = Nothing End Select %> </form> </body> </html> This is the directions i'm suspose to follow to make this work: "This approach is very simple, you put the javascript in the pdf file then submit a form to the pdf file using the GET method. The javascript will populate only the fields who's names match those in the header, the others will be ignored. Edited by - lu lu on 02/09/2002 15:47:24
|
|
|
|