I must please ask for your help again.
( this is a problem that has been annoying me since I first coded php and I have never fixed...please, please help! )
Essentially the problem is that if I either look at the form upload page ( addnews.php ) and don't enter data and then look at the page which displays the data ( view.php ) - extra line breaks are added to the display page.
If I am not using a form or table to display the results I don't get extra physical lines displayed, but the text is moved down the page.
...both are annoying...please help...
addnews.php
Code: Select all
<?php
<?
$fp = fopen('./news.txt','a+');
if (!$fp) {
echo "Sorry could'n open file!";
} else {
if($HTTP_POST_VARS['submit'])
$fp = fopen('./news.txt','a+');
$line = $HTTP_POST_VARS['date'] . "|" . $HTTP_POST_VARS['name'];
$line .= "|" . $HTTP_POST_VARS['news'];
$line = str_replace("\r\n","<br>",$line);
$line .= "\r\n";
fwrite($fp, $line);
}
?>
?>Code: Select all
<?php
<?PHP
$data = file('./news.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo "<form class="form"><b>". $pieces[1] . "</b>" . $pieces[0]. "</form>" ;
echo "<form class="form">" . $pieces[2] . "</form>" ;
}
?>
?>