|
| |
|
|
lu lu
Posts: 418 From: wpg, mb Status: offline
|
url encode asp - 2/8/2002 23:07:11
the url show the options fromthe drop boxes not the "msg" string... why is this? how can i fix it? i've chopped the code to shorten it and testing is based on Case "MBSUP-1" <%@ Language=VBScript %> <% Response.Buffer = true%> <% If appID<> "" Then Set connDB = Server.CreateObject("ADODB.Connection") connDB.Open "DBQ=" & Server.MapPath("..\db.mdb") & ";" & _ "DRIVER=Microsoft Access Driver (*.mdb)" sql = "SELECT appID FROM db" Set rs = connDB.Execute(sql) End If Function determineForm() If slct > 0 Then Select Case slct Case 1 determineForm = "0008ebus-1" : Exit Function Case 37 determineForm = "MBSUP-1" : Exit Function End Select 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> <option selected>select a form</option> <option value="1">MBSUP-1.pdf</option> </select></p> <p> <input type="submit"> </p> </form> <% strResult = LCase(determineForm()) Select Case strResult %> <% Case "MBSUP-1" data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db.mdb") Set rs = Server.CreateObject("ADODB.Recordset") rs.Open "select * from table", data_source Applicant_family_name = Trim(rs("Applicant_family_name")) Applicant_first_name = Trim(rs("Applicant_first_name")) mailing_address = Trim(rs("mailing_address")) applicants_birth_day = Trim(rs("applicants_birth_day")) applicants_birth_month = Trim(rs("applicants_birth_month")) age_factor = Trim(rs("age_factor")) msg = "Applicant_family_name=" & Trim(rs("Applicant_family_name")) & "&Applicant_first_name=" & Trim(rs("Applicant_first_name")) & "&mailing_address=" & Trim(rs("mailing_address")) & "&applicants_birth_day=" & Trim(rs("applicants_birth_day")) & "&applicants_birth_month=" & Trim(rs("applicants_birth_month")) & "&age_factor=" & Trim(rs("age_factor")) Response.Redirect "MBSUP-1.pdf?msg=" & Server.URLEncode(msg) rs.Close %> </body> </html> <% End Select %>
|
|
|
|
Spooky
Posts: 26597 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: url encode asp - 2/9/2002 14:29:12
If you stop the script like this, does it show msg? ..... "&age_factor=" & Trim(rs("age_factor")) response.write msg response.end Response.Redirect "MBSUP-1.pdf?msg=" & Server.URLEncode(msg) §þððk¥ Database / DRW Q & A VP-ASP Shopping cart Spooky Login
|
|
|
|
lu lu
Posts: 418 From: wpg, mb Status: offline
|
RE: url encode asp - 2/9/2002 18:48:51
i fixed it, the encoded url now pass with the redirect this this the working code, i havn't compared it to the previous post but after hours of fiddling it works: <%@ 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> <% 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 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) %> </form> </body> <% End Select %> </html>
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|