Jump to content

How do I post a solution into your PHP scripts?


Recommended Posts

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!

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

Example
Code
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!


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.