Jump to content


How do I post a solution into your PHP scripts?

  • Please log in to reply
No replies to this topic

#1 stephencadams

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 May 2006 - 01:52 PM

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!

echo "\r\n"; /* newline recognised by notebook in windows while comment does not appear */

echo ''.$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 Page

This 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!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users