Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file-output in textwindow o.k, but not in html-page

Status
Not open for further replies.

gosuc2000

Technical User
Jun 2, 2004
59
DE
Hello,
I have a form consisting of 7 text-fields and 2 textarea-fields which are written to disk after the submit-button is pressed. Each new form-content is appended
to the file in the same manner.
When I want to view the content of the entire file with my program (content.php), I get all
forms written to the file in sequential order correctly written
into a text-window, that is a <br> and a new line after each text-field and textarea field. When I want to echo
the same to a html-window with the same program, then the
entire file-content is contiguously written as one huge line into the window.

How do I have to read the file, so that each text-field and text-area is written on a seperate line, followed by a <br> ?


my form-fields are:
Company (text)
name(text)
chr-name(text)
address(textarea)
message(textarea)
Subj(text)
Tel(text
Fax(text)
E-Mail(text)

Here is the program that puts the file-content correctly to the thext-window, but not to the html window:

<!DOCTYPE HTML PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
"<html>
<head>
<title>Auswertung-Eingabeformular</title>
</head>
<body bgcolor="gold">
<?php
$datei="/srv/ to open
$fp=fopen($datei,"r");
$inhalt=fread($fp,filesize($datei)); <<< read filecontent
echo "$inhalt";
?>
</body>
</html>

Thanks in advance for any help


Regards,

Fred
 
Hello,
I solved the problem.
For those who are interested, here is the code to
display forms with mixed text- and textarea-fields in a html-window

<!DOCTYPE HTML PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
"<html>
<head>
<title>Auswertung-Eingabeformular</title>
</head>
<body bgcolor="gold">
<?php
$filename="/srv/$array=file($filename);
foreach($array as $line) {
echo trim($line) . "<br>\n";
}
?>
</body>
</html>


regards,

Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top