PHP interesse |
|
ik heb nu dit:
<?php
ob_start();
$date = date("d_m_Y", time());
if(!file_exists('shoutbox_'.$date.'.txt')) {
$file = fopen('shoutbox_'.$date.'.txt', "w+");
fputs($file, "");
fclose($file);
header("Location: index.php");
}else{
if(isset($_POST['verzend'])) {
$name = $_POST['name'];
$time = date("H:i:s", time());
$item = $_POST['item'];
$date = date("d_m_Y", time());
$file = fopen('shoutbox_'.$date.'.txt', "r+");
$oldfile = file('shoutbox_'.$date.'.txt');
fputs($file, $oldfile[0]."<tr><td>".$name."</td></tr><tr><td>".$time."</td></tr><tr><td>".$item."</td></tr>");
fclose($file);
}
$shoutbox = file("shoutbox_".$date.".txt");
echo '<table>';
echo $shoutbox[0];
echo '</table>';
?>
<form action="index.php" method='post'>
<input type="text" name="name" value='Naam' /><br />
<input type="text" name="item" value='Bericht' /><br />
<input type="submit" name="verzend" value="Plaats!"/ >
</form>
<?php
}
?>
<?php $file = fopen('shoutbox_'.$date.'.txt', "w+"); header("Location: index.php"); }else{ if(isset($_POST['verzend'])) { $name = $_POST['name']; $item = $_POST['item']; $file = fopen('shoutbox_'.$date.'.txt', "r+"); $oldfile = file('shoutbox_'.$date.'.txt'); fputs($file, $oldfile[0]."<tr><td>".$name."</td></tr><tr><td>".$time."</td></tr><tr><td>".$item."</td></tr>"); } $shoutbox = file("shoutbox_".$date.".txt"); ?> <form action="index.php" method='post'> <input type="text" name="name" value='Naam' /><br /> <input type="text" name="item" value='Bericht' /><br /> <input type="submit" name="verzend" value="Plaats!"/ > </form> <?php } ?>
hiervan werken er 2 dingen niet:(
de eerste is als ik een bericht plaats dan zie ik de oude tekst niet meer. de tweede is dat ik boven het formpje niks zie:( |