faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 8 people (100%) answered Yes
Recently 8 of 8 people (100%) answered Yes

Entry

how do i get ride of the \ in front of ",',\ when the user submits them in a form?

Sep 21st, 2001 18:45
Steph Bairey, John Bomhold,


After the user submits the data but before you use it (i.e. insert into 
database, or display on the screen) use the STRIPSLASHES function.

user inputs "I'm a new user."

your data is "I\'m a new user."

if data is stored in variable called $answer:  
   $answer = stripslashes($answer);

Your new data is "I'm a new user."

HTH