Small errors with feedback section

drf1229

New Member
Messages
71
Reaction score
1
Points
0
On my website (http://www.algebrahelper.x10hosting.com) I made a user feedback section where people can place their feedback onto a page of the website. It works like this: The feedback page is a file that gets edited each time a user submits feedback using PHP's fread and fwrite. This works fine, but I just have one problem. Whenever somebody submits a symbol, such as " ' / , etc. it appears with a backslash infront of it. This isn't a huge problem but prohibits users from posting some html tags. How can I stop/fix this? Please tell me if more detail is needed. Thanks!
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
Try using the php string function stripslashes($str). It will give you a string with backslashes stripped off.

Example #1 A stripslashes() example

PHP:
<?php
$str = "Is your name O\'reilly?";

// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>
To learn more about stripslashes, go to http://us2.php.net/manual/en/function.stripslashes.php (example source)
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
LOL, kbjradmin suggestion will also work. (Seems we posted almost at same time!)
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Just make sure you remove unsafe tags, such as <script>, <object>, <link>, <embed>, <style> &c, so your site isn't vulnerable to cross-site scripting.
 
Top