PHP forms using " ' "

Status
Not open for further replies.

Adam01

New Member
Messages
114
Reaction score
0
Points
0
How can you make it so when a user posts some text with ' in them, not screw it up?
 

Penguin129

New Member
Messages
68
Reaction score
0
Points
0
Could you please elaborate on "screw it up"? Your question is quite vague.
 

Xemnas

New Member
Messages
812
Reaction score
0
Points
0
I think what he meant is, when you post the quotation mark, it doesn't terminate the string or the SQL query.
 

kajasweb

New Member
Messages
1,723
Reaction score
0
Points
0
If you get the strings from user and want to use it, escape the quotation marks.

$input = str_replace("'","\'",$input);
 
Last edited:

Synkc

Active Member
Messages
1,765
Reaction score
0
Points
36
You could also convert the quotation characters to their html entities:

$string = str_replace( '"','"', $string );
$string = str_replace( "'",''', $string );
 
Status
Not open for further replies.
Top