Hi,
I'm just getting started with php and I'm building a guestbook with php atm.
I have a problem, when I add a message the page directly goes to the second page without updating it (it doesn't show the added message). It only updates when you press f5 (refresh), but then there are actually two the same messages added to the sql database (now one is showed at page 2)....
I tried a third page which redirects to the second page but that also didn't work and I can't find a way to autorefresh the site or something like that in these forums....
I hope someone can help me, thanx in advance
Joost
I'll put the two pages of code within this post, to clear things up
<b>Page 1</b>
<php>
<html>
<head>
<title>Gastenboek</title>
</head>
<body bgcolor="#303056" text="#FFFFFF">
<table align="center">
<td><tr><img border="0" src="top.jpg" width="700" height="132" align="center"></td></tr>
<td><tr><img border="0" src="gastenboek.gif" width="250" height="38" align="center"></td></tr>
</table>
<TABLE width="100%" cellspacing="0" cellpadding="0" align="center">
<TR><TD>
<FORM action="gastenboek2.php" method="post">
<INPUT type="hidden" name="action" value="write">
<TABLE align="center">
<TR><TD>Alle velden moeten verplicht worden ingevuld!<br><br></TD></TR>
<TR><TD>Naam:</TD><TD><INPUT type="text" name="naam" size="30"></TD></TR>
<TR><TD>E-Mail:</TD><TD><INPUT type="text" name="mail" size="30"></TD></TR>
<TR><TD>Homepage:</TD><TD><INPUT type="text" name="website" size="30"></TD></TR>
<TR><TD>Bericht:</TD><TD><TEXTAREA name="bericht" cols="50" rows="5"></TEXTAREA></TD></TR>
<TR><TD><br><br><br><INPUT type="submit" value="Verstuur"></TR></TD>
</TABLE>
</FORM>
</TD></TR>
</TABLE>
</body>
</html>
</php>
<b>End of Page 1</b>
<b>Page 2 </b>
<php>
<html>
<head>
<title>Gastenboek</title>
</head>
<body bgcolor="#303056" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF">
<table align="center">
<td><tr><img border="0" src="top.jpg" width="700" height="132" align="center"></td></tr>
<td><tr><img border="0" src="gastenboek.gif" width="250" height="38" align="center"></td></tr>
<td><tr><a href="gastenboek1.php">schrijf een bericht</a></td></tr>
</table>
<?
require("gastenboek3.php");
mysql_connect("$dbhost","$dbuser","$dbpass");
mysql_select_db("pw");
$res=mysql_query("SELECT * FROM joostgastenboek ORDER BY recordnr DESC");
$naam =$POST["naam"];
$mail =$POST["mail"];
$website =$POST["website"];
$bericht =$POST["bericht"];
if ($naam != "") {
mysql_query ("INSERT INTO joostgastenboek (naam,mail,website,bericht)VALUES ('$naam','$mail','$website','$bericht')");
}
?>
<?php
$date=date("d.m.y");
$naam =$POST["naam"];
$naam1=
$mail =$POST["mail"];
$website =$POST["website"];
$bericht =$POST["bericht"];
?>
<?
while ($r = mysql_fetch_array($res)) {
?>
<TABLE border="0" align="center" bgcolor="#99CCFF" width=700>
<TR><TD width=150><?=$r["naam"]?> schreef op <?= $date ?><hr></TD></TR>
<TR><TD width=150>E-Mailadres:</TD><TD><?= $r["mail"]?></TD></TR>
<TR><TD width=150>Homepage:</TD><TD><?= $r["website"]?></TD></TR>
<TR><TD width=150>Bericht:</TD><TD><?= $r["bericht"]?></TD></TR>
</TABLE><br><br>
<?
}
?>
<TABLE border="0" align="center">
<TR><TD>
<IMG height=30 src="bottom.jpg" width=700 border=0>
</TD></TR>
</table>
</body>
</html>
</php>
</b>End of Page 2</b>
PS. why doesn't <php>text</php> work????....