Halyard Posted January 27, 2009 Share Posted January 27, 2009 I am teaching myself PHP, and wrote this snippet to test escape characters:- <?php echo "This piece has been written to test escape characters,/n"; echo "especially the newline/n"; echo "character..."; ?> Expecting to see something like this:- This piece has been written to test escape characters, especially the newline character... Not something like this:- This piece has been written to test escape characters,/nespecially the newline/ncharacter... I have already done some extensive searching, and most answers seem to say that magic_quotes should be set to OFF, and all will work (Maniacial Laugh Here) This from the PHP Info page:- magic_quotes_gpc Off Off magic_quotes_runtime Off Off magic_quotes_sybase Off Off So WTF is wrong - it beats me! Link to comment https://forums.phpfreaks.com/topic/142630-solved-escape-characters-not-escaping/ Share on other sites More sharing options...
dennismonsewicz Posted January 27, 2009 Share Posted January 27, 2009 your slashes are the wrong way... so not /n but \n Link to comment https://forums.phpfreaks.com/topic/142630-solved-escape-characters-not-escaping/#findComment-747576 Share on other sites More sharing options...
Halyard Posted January 27, 2009 Author Share Posted January 27, 2009 your slashes are the wrong way... so not /n but \n OMFG!!!!! The one thing I did not check! What a effing DUMMY! Talk about not being able to see the wood for the trees... Thanks for spotting the bleedin obvious. Link to comment https://forums.phpfreaks.com/topic/142630-solved-escape-characters-not-escaping/#findComment-747579 Share on other sites More sharing options...
PFMaBiSmAd Posted January 27, 2009 Share Posted January 27, 2009 And once you get the escape character correct, a \n does not have any meaning in HTML. When you output it to the browser it formats the source code of the page. You need a <br> or <br /> tag to cause a newline in the HTML content. Link to comment https://forums.phpfreaks.com/topic/142630-solved-escape-characters-not-escaping/#findComment-747580 Share on other sites More sharing options...
dennismonsewicz Posted January 27, 2009 Share Posted January 27, 2009 your slashes are the wrong way... so not /n but \n OMFG!!!!! The one thing I did not check! What a effing DUMMY! Talk about not being able to see the wood for the trees... Thanks for spotting the bleedin obvious. LOL its cool bro. We all have been there... I know I have been there on more than one several occasion! Link to comment https://forums.phpfreaks.com/topic/142630-solved-escape-characters-not-escaping/#findComment-747581 Share on other sites More sharing options...
Halyard Posted January 27, 2009 Author Share Posted January 27, 2009 And once you get the escape character correct, a \n does not have any meaning in HTML. When you output it to the browser it formats the source code of the page. You need a <br> or <br /> tag to cause a newline in the HTML content. Ah, so maybe that's why when I changed the slashes I still got this:- This piece has been written to test escape characters, especially the newline character... instead of this:- This piece has been written to test escape characters, especially the newline character... Link to comment https://forums.phpfreaks.com/topic/142630-solved-escape-characters-not-escaping/#findComment-747587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.