For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2004 > \' and \" (general escape characters)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author \' and \" (general escape characters)
Viruss

2004-05-23, 6:32 am

Hello,

This is my first post and I am rather 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 parse 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


Filth

2004-05-23, 7:32 am

> This is my first post and I am rather 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 parse 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 http://uk.php.net/addslashes and
http://uk2.php.net/stripslashes


Viruss

2004-05-28, 7:31 am

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

"Filth" <p.macdonald@blueyonder.co.uk> wrote in message
news:IJ_rc.13509$FV7.717@doctor.cableinet.net...
> submits
> changed
> the
> Now
get[color=darkred]
> a
'[color=darkred]
be[color=darkred]
> a
bypassing[color=darkred]
>
> looks like you need http://uk.php.net/addslashes and
> http://uk2.php.net/stripslashes
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com