http://www.flat3media.nl/testserver/Kitestyle/shoutbox.php

De shoutbox werkt wel, maar na plaatsing krijg ik telkens een foutmelding. Tevens wil ik een spatie tussen de berichten hoe doe ik dat?

hieronder het script:

<html>
<head>
<title>Kitestyle.nl - Shoutbox</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.stijl1 {color: #FFFFFF}
body {
background-color: #FF00D8;
}
body,td,th {
font-family: arial;
font-size: 12px;
color: #000000;
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">


<div align="center">
<!-- ImageReady Slices (design.psd) -->
<table width="1025" height="768" border="0" align="left" cellpadding="0" cellspacing="0" id="Tabel_01">
<tr>
<td colspan="5">
<img src="afbeeldingen/index_01.jpg" alt="" width="1024" height="133" border="0" usemap="#Map"></td>
<td>
<img src="afbeeldingen/spacer.gif" width="1" height="133" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="afbeeldingen/index_02.jpg" width="246" height="135" alt=""></td>
<td width="663" height="575" rowspan="3" align="left" valign="top" bgcolor="#FFFFFF"><img src="afbeeldingen/deberichten.jpg" alt="de berichten" width="108" height="14"><br>
<br>
<?PHP
error_reporting(E_ALL);
$bestand = fopen('shoutboxtext.txt','a+');
$regels = file('shoutboxtext.txt');


if ( isset ( $_POST['submit'] ) ) {
if ( !empty( $_POST['name'] ) && !empty( $_POST['msg'] ) ){
$shout = '<b>' . htmlspecialchars($_POST['name']) . '</b>: ' . htmlspecialchars($_POST['msg']);
// echo $shout;
fwrite($bestand,"\n$shout");
fclose($bestand);
header('Location: shoutbox.php');
}

else {
echo 'You didn\'t fill in you\'re name and/or message';
}
}
fclose($bestand);

if ( isset ( $_GET['show'] ) ) {
if ( $_GET['show'] == 'all'){ $hoeveel = count($regels); }
else { $hoeveel = $_GET['show']; }
}
else {
$hoeveel = 10;
}

for($i=count($regels);count($regels)-$i<$hoeveel;$i--){
echo $regels[$i-1] . '<br/>';
}

?></td>
<td rowspan="4"><img src="afbeeldingen/index_04.jpg" width="115" height="635" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="1" height="135" alt=""></td>
</tr>
<tr>
<td rowspan="3">
<img src="afbeeldingen/index_05.jpg" width="22" height="500" alt=""></td>
<td width="196" height="141" align="left" valign="top" bgcolor="#000000"><form action="shoutbox.php" method="post">
<span class="stijl1">Naam:
<input type="text" name="name" />
<br />
<br>
Bericht:</span>
<textarea name="msg"></textarea>
<br/>
<input type="submit" name="submit" value="Stuur bericht!">
</form> </td>
<td rowspan="3">
<img src="afbeeldingen/index_07.jpg" width="28" height="500" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="1" height="141" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="afbeeldingen/index_08.jpg" width="196" height="359" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="1" height="299" alt=""></td>
</tr>
<tr>
<td>
<img src="afbeeldingen/index_09.jpg" width="663" height="60" alt=""></td>
<td>
<img src="afbeeldingen/spacer.gif" width="1" height="60" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->

<map name="Map">
<area shape="rect" coords="498,90,671,130" href="shoutbox.php?show=5">
<area shape="rect" coords="682,86,855,127" href="shoutbox.php?show=all">
</map>
</div>
</body>
</html>
Tja dat snap ik, maar graag wat duidelijker.

Ik zelf ben bezig geweest om een classe te schrijven die de html etc. bij zich houdt en aan het einde past weer geeft. Want wat nou als je in die doeiets wat wilt weergeven? Dan moet je deze dus in een variabele zetten.

Maar om telkens $sOutput .= 'Foobar'; te gebruiken is ook niet mooi (ook al is het beter).

Reageren