OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
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.

Follow Us
On Facebook
On Twitter
RSS
Via Email

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

 

Don't Quote me!

 
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, PHP, and Database >> Don't Quote me!
Page: [1]
 
 
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
Don't Quote me! - 11/15/2004 15:08:35   
I have a link to a document made from info the user gave in a form. The link doesn't work when people use single quotes in the form.

I've got this...

mySQL = "SELECT DocTitle, FileName FROM KeyDocs"

myFileName = myRS("FileName")

myFileName = Replace(myFileName, "'", "''")

Response.write "<TR><TD><P><a href='/documents/" & myFileName & "'>" & myRS("DocTitle") & "</A>"


But using the Filename Children'sNSF09MentalHealth.pdf just gives a link of /documents/Children

What am I missing? I've checked the values using Response.writes and tried using both for the link
myRS("Filename") = Children'sNSF09MentalHealth.pdf and
myFileName = Children''sNSF09MentalHealth.pdf
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Don't Quote me! - 11/15/2004 18:31:08   
What happens if you replace:

" & myFileName & "

with

" & Server.URLEncode(myFileName) & "

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to yogaboy)
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: Don't Quote me! - 11/17/2004 6:53:46   
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'Server.URLencode'

I've tried loads of different combinations of code, but whenever I put Server.URLencode anywhere I get this error. Had a look for a solution but it seems it's sporadic and happens on some servers and not on others.

Jam!:)

(in reply to BeTheBall)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Don't Quote me! - 11/17/2004 8:26:27   
What if you put your URL into a variable and then call it later something like:

mySQL = "SELECT DocTitle, FileName FROM KeyDocs"

myFileName = myRS("FileName")

myURL = Server.URLEncode("/documents/" & myFileName)

Response.write "<TR><TD><P><a href='"&myURL&"'>" & myRS("DocTitle") & "</A>"

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to yogaboy)
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: Don't Quote me! - 11/17/2004 9:37:03   
It worked! Amazing!!!:) - thanks Duane - I'd almost lost hope...

Here's the final code, trimmed of extra ' and /'s

myFileName = myRS("Filename")

myURL = Server.URLEncode("documents/" & myFileName)

Response.write "<TR><TD><P><a href=" & myURL & ">" & myRS("DocTitle") & "</A>"



(in reply to BeTheBall)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Don't Quote me!
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