navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

url encode asp

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> url encode asp
Page: [1]
 
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

(in reply to lu lu)
lu lu

 

Posts: 418
From: wpg, mb
Status: offline

 
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

(in reply to lu lu)
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>


(in reply to lu lu)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> url encode asp
Page: [1]
Jump to: 1





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