[RESOLVED] apostrophes in php
Hi! This should be an obvious question with an easy answer. How do you echo an apostrophe without having a backslash behind it?
Thanks, but that's not my question. When I execute echo code, say "Fred's", "Fred\'s" is echoed. How do I change it so it simply puts "Fred's"?
Last edited by shane.carr; 06-01-2006 at 11:23 AM.
The echo is not inserting the slash. The slash is (most likely) due to the data being output coming from a form input, and your installation of PHP (correctly) having "magic quotes" enabled. In any case, the stripslashes function will remove those slashes. To make the code portable (in case it's ever on a server where "magic quotes" are not enabled), you can do something like:
$text = $_POST['text'];
$text = stripslashes($text);
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)