Hab hier ein Formular, bei dem ich verhindern will, das der Text beim aktualisieren der Seite nochmal weggeschickt wird. Wie mache ich das ? Auf IP und Inhalt der Nachricht prüfe ich schon, aber ich hätte gerne, das das Feld nach abspeichern in der DB zurückgesetzut wird auf "".
Hier das Script
Hier das Script
Code:
/////////////////////
//Shoutbox
/////////////////////
if (isset($shoutsubmit) && $shouttext != '' && $shouttext != "Message")
{
$r_last = thwb_query("SELECT shoutip FROM ".$pref."shoutbox ORDER BY posttime DESC LIMIT 1");
$last = mysql_fetch_array($r_last);
if ($REMOTE_ADDR != $last['shoutip'])
{
$shouttext = ereg_replace("'", "", $shouttext);
$shouttext = split(" ", $shouttext);
for($i = 0; $i < sizeof($shouttext); $i++)
{
if(strlen($shouttext[$i]) > 20) //Set here the maximum number of letters per word
{
$shouttext[$i] = substr($shouttext[$i],0,20);
}
$shouttext = implode(" ",$shouttext);
$time = time();
thwb_query("INSERT INTO $pref"."shoutbox (posttime, posttext, postguestname, shoutip) VALUES ('$time', '$shouttext', '".$g_user['username']."', '$REMOTE_ADDR')");
}
}
}
$shoutbox = "<table width=\"190\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"$style[CellA]\">";
$shoutbox .= "<tr><td align=\"center\"><form method=\"post\" action=\"".build_link("index.php")."\" name=\"shout\">
<p>
<input type=\"text\" name=\"shouttext\" value=\"Message\"> <input class=\"tbinput\" type=\"submit\" name=\"shoutsubmit\" value=\"GO\">
</p>
</form></td></tr>";
$r_shoutbox = thwb_query("SELECT postguestname, posttext, posttime FROM ".$pref."shoutbox ORDER BY posttime DESC LIMIT 5");
$i = "0";
while ($shouttmp = mysql_fetch_array($r_shoutbox))
{
$shouttmp['posttext'] = parse_code($shouttmp['posttext'], 1, 1, 1, 0);
$shoutbox .= "<tr><td bgcolor=\"$style[CellB]\">$style[smallfont]<b>".$shouttmp['postguestname']."</b>, ".form_date($shouttmp['posttime'])."$style[smallfontend]</td></tr>
<tr><td></td></tr><tr><td>$style[smallfont]".$shouttmp['posttext']."$style[smallfontend]<br><br></td></tr>";
$i++;
}
$shoutbox .= "</table>";
/////////////////////
//Shoutbox
/////////////////////