PDA

View Full Version : -ASP- Inserting ' character



Digitalosophy
September 15th, 2003, 01:40 AM
Having a problem when the user try's to insert the ' character. I can't seem to replace that character, is that what I should be doing?

Everything works fine until the ' comes about, any idea's?



<% @ Language=VBScript %>
<%
a=Request.Form("author")
e=Request.Form("author_email")
q=Request.Form("question")
ans=Request.Form("answer")
%>
<!--#include file="connection.asp"-->
<% SQL = "INSERT INTO FAQ (name, email, question, answer) VALUES ('"&a&"','"&e&"','"&q&"', '"&ans&"')"
conn.Execute(SQL) %>

abzoid
September 15th, 2003, 03:38 AM
Yes, a replace is what you need to do. Something like this should work:


<%
a = Replace(Request.Form("author"),"'","''")
e = Replace(Request.Form("author_email"),"'","''")
q = Replace(Request.Form("question"),"'","''")
ans = Replace(Request.Form("answer"),"'","''")
%>

Digitalosophy
September 15th, 2003, 02:21 PM
hey thanks abzoid, havent tested it yet but seems like a solution to me


thanks!