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! Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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! Quote Link to comment 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... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.