Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    escaping commas when uploading from form

    Im looking for some help... I have a simple form on my site that uploads some text to a database (access).

    here is the form....
    Code:
    <form name="frmInsert" method="post" action="insertProcess.asp">
    <input type="hidden" name="insrow" value="1">
    <p>Subject<br/><input type="text" name="newsMonth1" size="30"></p>
    <p>&nbsp;</p>
    <p>News Body<br/>
    <textarea name="newsItem1" cols="35" rows="8" id="Address"></textarea></p>
    <p>&nbsp;</p>
    <input type="submit" value="Submit">
    </form>

    and here is the part that uploads....

    Code:
    <%
    Dim Conn
    Dim SQLTemp
    
    If request("insrow") = "1" THEN
    newsItem2 = request("newsItem1")
    newsMonth2 = request("newsMonth1")
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" _ 
    & Server.Mappath("../one.mdb") & ";" 
    Conn.Open 
    
    SQLTemp = "INSERT INTO bevRacesNews (newsItem, newsMonth) VALUES ('" & newsItem2 & "','" & newsMonth2 & "')"
    Conn.execute(SQLTemp) 
    
    
    Conn.Close
    Set Conn = Nothing
    response.write("<p>new news item inserted!</p><p>&nbsp;</p><p><a href=""admin.asp"" class=""Green"">back to admin options</a></p>")
    End If
    %>


    But if within this form I insert certain characters, mainly ''''''
    it doesnt upload. I know I need to escape these, but how?


    cheers

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    see this sticky on top of this forum: click
    I am the luckiest man in the world


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •