Zdravíčko lidi... mám tenhle jednoduchý script a potřeboval bych udělat aby text který se čte ze souboru msg.txt zobrazil do tabulky o třech sloupcích... Pomůžete mi někdo? Díky moc
TEXT:
<head>
<title>Pokec</title>
</head>
<body>
<center>
<h2>Pokec</h2>
<form action="pokec.php" method="post">
<?php
if ($HTTP_POST_VARS["username"] != "") : ?>
Zadejte zpravu
<input type="hidden" name="username" value="<?php echo $HTTP_POST_VARS["username"]?>"/>
<input type="text" name="zprava"/>
<?php else : ?>
Zadejte jmeno
<input type="text" name="username"/>
<?php endif ?>
<input type="submit" value="Odeslat"/>
<input type="reset" value="Storno"/>
<?php
if ($HTTP_POST_VARS["username"] != "") : ?>
<input type="submit" value="Odhlasit" onclick="username.value='';"/>
<?php endif?>
</form>
<br/><br/>
<?php
if ($HTTP_POST_VARS["zprava"] != "") {
$fp = fopen("msg.txt", "a+");
fwrite($fp, "<b>".$HTTP_POST_VARS["username"].": </b>".$HTTP_POST_VARS["zprava"]." <i>".date('d.m.Y H:s')."</i><br/>\n");
fclose($fp);
}
if ($HTTP_POST_VARS["username"] != "")
@ readfile("msg.txt");
?>
</center>
</body>
<HTML><?php
if ($HTTP_POST_VARS["zprava"] != "") {
$fp = fopen("msg.txt", "a+");
fwrite($fp, $_POST["username"].";".$_POST["zprava"].";".date('d.m.Y H:s')."\n");
fclose($fp);
}
if ($HTTP_POST_VARS["username"] != "")
@ readfile("msg.txt");
?>
<head>
<title>Pokec</title>
</head>
<body>
<center>
<h2>Pokec</h2>
<form action="pokec.php" method="post">
<?php
if ($HTTP_POST_VARS["username"] != "") : ?>
Zadejte zpravu
<input type="hidden" name="username" value="<?php echo $HTTP_POST_VARS["username"]?>"/>
<input type="text" name="zprava"/>
<?php else : ?>
Zadejte jmeno
<input type="text" name="username"/>
<?php endif ?>
<input type="submit" value="Odeslat"/>
<input type="reset" value="Storno"/>
<?php
if ($HTTP_POST_VARS["username"] != "") : ?>
<input type="submit" value="Odhlasit" onclick="username.value='';"/>
<?php endif?>
</form>
<br/><br/>
<table>
<?php
$dat = file("msg.txt");
for($i - 0; $i < count($dat); $i++) {
$data = explode(";", $dat);
echo "<tr><td><b>$data[0]</b></td><td>$data[1]</td><td><i>$data[2]</i></td></tr>";
}
?>
</table>
</center>
</body></HTML>