I was able to correct an issue I had with writing data to a flat file with PHP last night, and I can read and display the text from the .txt file as well, but I am now wanting to make the displayed data look nice. I am using the following...
<?php
//create short variable name
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT']."xxx";
?>
<html>
<head>
<title>Guest Book Entries</title>
</head>
<body>
<?php
@ $fp = fopen("$DOCUMENT_ROOT/xxx/guest.txt", 'rb');
if (!$fp)
{
echo '<p><strong>Nada!</strong></p>';
exit;
}
while (!feof($fp))
{
$guest= fgets($fp, 999);
echo $guest.'<br />';
}
fclose($fp);
?>
</body>
</html>
which produces output like this when executing the script...
crap username crap@crap.com eaddress craptastic comments
The bold items are the actual variable names. So, what I want to do is reverse the way this appears (ex: variable name first, data after) and make it look a little prettier (ex: a table maybe?)
Any ideas?
Thanks,
Jim