08-23-2007, 01:29 PM
Hi all I have a little sign up form on my website, and when people sign up if they sign up say with a "'" in there name, when I pull the name from the database it come's in as O/'Brien... How do I get rid of this? With strip_tags?
08-23-2007, 03:19 PM
Thanks rafiki, I am working on another programmers file and trying to work out why they have done this on the insert.php page of the sign up form... Why would they want to add slashes, any ideas??
$FirstName = addslashes( mb_convert_case($_SESSION['strFirstName'], MB_CASE_TITLE, "UTF-8")); // Capitilize the first character for mailing list
08-23-2007, 03:23 PM
Actually I read about it...
An example use of addslashes() is when you're entering data into a database. For example, to insert the name O'reilly into a database, you will need to escape it. Most databases do this with a \ which would mean O\'reilly. This would only be to get the data into the database, the extra \ will not be inserted. Having the PHP directive magic_quotes_sybase set to on will mean ' is instead escaped with another '
So then I need to keep it how it is otherwise it won't insert into the database correct? My other page pulls the data out of the database into a .csv file and this is where I am noticing the / so is it correct to think addslashes is used when inserting data into a database and stripslashes used when pulling it out?