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!
I am fairly new to php and using the functions correctly to validate certain information. I know that this is fairly simple to do but when I print out my data which is taken from a database names such as O'Hara comes out with 7 slashes in front of the apostrophe. The name is stored in the database (mysql) as is "O'Hara". I basically need an idea so I may see what is the best way to to apply in trying to fix that problem. I presently have this little thing that I am using, however, it is not working correctly.
Thanks for the info you provided. However, when I try this new function using the "preg_match" function the way that you have suggested, I am unable to enter names such as "O'Hara" (it goes to my error message that points out that the name is invalid). What do you think needs to be changed in order to accept and name such as "O'Hara"?
Stripslashes(), works very well to get rid of the slashes when viewing the data that had been slashed. However, for some reason these slashes are still on when when I insert this data into the database as part of my "insert_event()" function that was written. Does anyone know why these slashes (as many as 15) would be added to the data when it is being sent to the database even though it does not have the slashes when viewed just before being sent to the database? If anyone knows, what is the best way to get rid of that problem?