stephencadams Posted May 2, 2006 Share Posted May 2, 2006 I am a recent convert to PHP from HTML and I am using it to produce static web pages.One of the problems I had, was that the editor did not produce html web pages from PHP scripts, it only displayed them.I have to produce the page (including the items stored in a database), then dump the script into notepad in Windows and then save that as my static web page source.I could not format the html page properly, so I could see the beginning and end of the text inserts from the databases were and adding \n and \r on their own gave funny chrs in notepad.I finally solved the problem by using echo "\r\n"; which inserts the correct sequence for notepad to assume it is an end of line.I even put comments in the PHP page, which do not come out in the web page source code.So if you need to properly format HTML code from a generated PHP page use this!Codeecho "\r\n"; /* newline recognised by notebook in windows while comment does not appear */ExampleCodeecho ''.$row['Article1'].' '.$row['Article2'].$row['Article3'].'</FONT></TD></TR>'; echo "\r\n"; /* newline recognised by notebook in windows while comment does not appear */ echo '<TR><TD><FORM METHOD="LINK" ACTION="'.$row['Link'].'"><H4><INPUT TYPE="SUBMIT" VALUE="'.$row['LinkName'].'" ></H4></FORM></TD></TR>';Produces HTML PageThis text is extracted from the database</FONT></TD></TR><TR><TD><FORM METHOD="LINK" ACTION="'http://www.somewhere.com'"><H4><INPUT TYPE="SUBMIT" VALUE="Somewhere " ></H4></FORM></TD></TR>separating out the two different lines, which HTML ignores, but formats the page for humans!Question, How do I get this put into one of your PHP scripts or users submitted tutorials?I know it is a bit simple, but I have not found this anywhere else, and it is very essential to me! Quote Link to comment https://forums.phpfreaks.com/topic/8888-how-do-i-post-a-solution-into-your-php-scripts/ 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.