Replacing single quotes from text box to db

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
odie2828
Forum Commoner
Posts: 39
Joined: Tue Aug 05, 2008 4:40 pm

Replacing single quotes from text box to db

Post by odie2828 »

I have a form that you can enter a subject and then a story.

if you enter anything in the text boxes that has a single quote, when it posts that info from the db it puts a slash infront of it.

Anyone know how to fix?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Replacing single quotes from text box to db

Post by VladSun »

Take a look at
mysql_real_escape_string() - before inserting into DB.
stripslashes() - when outputing to HTML.
There are 10 types of people in this world, those who understand binary and those who don't
odie2828
Forum Commoner
Posts: 39
Joined: Tue Aug 05, 2008 4:40 pm

Re: Replacing single quotes from text box to db

Post by odie2828 »

Thank you very much!
Post Reply