Professional Web Applications Themes

\' and \" (general escape characters) - PHP Development

Hello, This is my first post and I am rather confused about how to fix this problem. On the site that I am designing I have a form that users enter specific data and then submit it. Now the data ends up being saved into mysql. Now the problem is if the user types a ' in the form and then submits it the php p assumes that the ' is the end of a php string. So I changed the string to have " instead of the '. Now if the user types a " it does the same ...

  1. #1

    Default \' and \" (general escape characters)

    Hello,

    This is my first post and I am rather confused about how to fix this
    problem. On the site that I am designing I have a form that users enter
    specific data and then submit it. Now the data ends up being saved into
    mysql. Now the problem is if the user types a ' in the form and then submits
    it the php p assumes that the ' is the end of a php string. So I changed
    the string to have " instead of the '. Now if the user types a " it does the
    same thing. I tried using mysql_escape_string. This solved the problem. Now
    when I load the data back onto the webpage for the user to verify it i get a
    \' or \" in the string they submitted. What I want to do is convert the \'
    and \" back to there general character for displaying. I know this may be a
    simple feat to over come but I have been looking and seem to be bypassing
    whatever it is that needs to fix this. If anyone can help that would be
    great. Thanks


    Viruss Guest

  2. #2

    Default Re: \' and \" (general escape characters)

    > This is my first post and I am rather confused about how to fix this
    > problem. On the site that I am designing I have a form that users enter
    > specific data and then submit it. Now the data ends up being saved into
    > mysql. Now the problem is if the user types a ' in the form and then
    submits
    > it the php p assumes that the ' is the end of a php string. So I
    changed
    > the string to have " instead of the '. Now if the user types a " it does
    the
    > same thing. I tried using mysql_escape_string. This solved the problem.
    Now
    > when I load the data back onto the webpage for the user to verify it i get
    a
    > \' or \" in the string they submitted. What I want to do is convert the \'
    > and \" back to there general character for displaying. I know this may be
    a
    > simple feat to over come but I have been looking and seem to be bypassing
    > whatever it is that needs to fix this. If anyone can help that would be
    > great. Thanks
    >
    looks like you need [url]http://uk.php.net/addslashes[/url] and
    [url]http://uk2.php.net/stripslashes[/url]


    Filth Guest

  3. #3

    Default Re: \' and \" (general escape characters)

    Thanks for the help it worked exactly how i wanted it to.

    "Filth" <p.macdonaldblueyonder.co.uk> wrote in message
    news:IJ_rc.13509$FV7.717doctor.cableinet.net...
    > > This is my first post and I am rather confused about how to fix this
    > > problem. On the site that I am designing I have a form that users enter
    > > specific data and then submit it. Now the data ends up being saved into
    > > mysql. Now the problem is if the user types a ' in the form and then
    > submits
    > > it the php p assumes that the ' is the end of a php string. So I
    > changed
    > > the string to have " instead of the '. Now if the user types a " it does
    > the
    > > same thing. I tried using mysql_escape_string. This solved the problem.
    > Now
    > > when I load the data back onto the webpage for the user to verify it i
    get
    > a
    > > \' or \" in the string they submitted. What I want to do is convert the
    \'
    > > and \" back to there general character for displaying. I know this may
    be
    > a
    > > simple feat to over come but I have been looking and seem to be
    bypassing
    > > whatever it is that needs to fix this. If anyone can help that would be
    > > great. Thanks
    > >
    >
    > looks like you need [url]http://uk.php.net/addslashes[/url] and
    > [url]http://uk2.php.net/stripslashes[/url]
    >
    >

    Viruss Guest

Similar Threads

  1. Replies: 0
    Last Post: January 17th, 07:47 PM
  2. Replies: 3
    Last Post: March 5th, 03:50 PM
  3. redefining Net::Telnet "escape" character
    By Joe mecklin in forum PERL Modules
    Replies: 1
    Last Post: February 28th, 11:19 PM
  4. Escape regex harmful characters
    By Kevin Old in forum PERL Beginners
    Replies: 3
    Last Post: December 31st, 03:59 AM
  5. Escape sequence for unicode characters in NSString
    By Eric Raas in forum Mac Programming
    Replies: 2
    Last Post: July 9th, 02:03 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139