Formular -> Zurück

Slater

Erfahrenes Mitglied
Hy,
Ich habe folgendes Problem:
Ich habe nun da ein Quiz in php programmiert. Jetzt wenn der User all die Fragen hat drückt er den Button "weiter".
Danach erscheint was er falsch und was gut hatte. Jedoch wenn man jetzt beim BROWSER den Button "Zurück" drückt, kann er all seine Antworten, wie er Sie abgegeben hat anschauen.
Wie kann ich es nun machen, dass das Formular beim zurückgehen "gelöscht" ist?

mfg Slater

Mein Code:
PHP:
<?php
$Frage = "1";
print ("<body bgcolor=$bgcolor2><font face=$fontface2 color=$fontcolor2 size=$fontsize2><b>Quiz</b><p>");
$display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
if (!$submit) {
	echo "<form method=get action=$PHP_SELF>";
	echo "<table border=0>";
	while ($row = mysql_fetch_array($display)) {
	$id = $row["id"];
	$question = $row["question"];
	$opt1 = $row["opt1"];
	$opt2 = $row["opt2"];
	$opt3 = $row["opt3"];
 	$opt4 = $row["opt4"];
	$answer = $row["answer"];
echo "<tr><td colspan=3><br><b><font face=$fontface2 color=$fontcolor2 size=$fontsize2>Frage $Frage</b><p>$question</font></td></tr>";
echo "
 <tr>
 <td>
 <input type=radio name=q$id value=\"$opt1\"> <font face=$fontface2 color=$fontcolor2 size=$fontsize2>$opt1</font>
 </td>
 </tr>
 <tr>
 <td>
 <input type=radio name=q$id value=\"$opt2\"> <font face=$fontface2 color=$fontcolor2 size=$fontsize2>$opt2</font>
 </td>
 </tr>
 <tr>
 <td>
 <input type=radio name=q$id value=\"$opt3\"> <font face=$fontface2 color=$fontcolor2 size=$fontsize2>$opt3</font>
 </td>
 </tr>
  <tr>
 <td>
 <input type=radio name=q$id value=\"$opt4\"> <font face=$fontface2 color=$fontcolor2 size=$fontsize2>$opt4</font>
 </td>
 </tr>
 ";
$Frage++;
	}
	echo "</table>";
	echo "<p><input type='submit' value='Weiter' name='submit'>";
	echo "</form>";
}
elseif ($submit)
{
	$score = 0;
	$total = mysql_num_rows($display);
		while ($result = mysql_fetch_array($display)) 
		{
			$answer = $result["answer"];
			$q = $result["q"];
			
		if ($$q == $answer) 
		{
		$score++; 
		}
	}
	echo "<font face=$fontface2 color=$fontcolor2 size=$fontsize2>Deine Punktzahl: <b>$score</b> von <b>$total</b></font>";
	echo "<p>";
	
	if   ($score == $total) {
	echo "<font face=$fontface2 color=$fontcolor2 size=$fontsize2>Gratuliere, Du hast jede Frage richtig beantwortet!</font>";
	}
	elseif ($score/$total < 0.34) {
	echo "<font face=$fontface2 color=$fontcolor2 size=$fontsize2>Sorry, aber Du hast nicht viel gewusst ;-)</font>";
	}
	elseif ($score/$total > 0.67) {
	echo "<font face=$fontface2 color=$fontcolor2 size=$fontsize2>Du kennst dich nicht schlecht aus ;-)</font>";
	}
	else {
	echo "<font face=$fontface2 color=$fontcolor2 size=$fontsize2>Geht so :-)</font>";
	}
echo "</p>";
echo "
<font color=#cccccc>-</font>
<p>
<form action=http://www.ol4you.ch/Version2/Punkte_eintragen.php method=post>
<p>
<b>Bestenliste:</b>
<p>
Deine Name:<br>
<input type=text size=20 name=Name variable=Name>
<input type=hidden name=Punkte variable=Punkte value=$score>
<p>
<input type=submit value=Eintragen name=submit>
</form>
<table border=0>";
$Frage2="1";
$display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
while ($row = mysql_fetch_array($display)) {

$question = $row["question"];
$answer = $row["answer"];
$q = $row["q"];

echo "<tr><th colspan=2 valign=left align=left><br><left><font face=$fontface2 color=$fontcolor2 size=$fontsize2><b>Frage $Frage2:</b></left></font></th></tr>";

if ($$q == $answer) 
		{
		echo "<tr><td><font face=Wingdings color=green size=+1><b>ü</b></font></td><td><font face=$fontface2 color=$fontcolor2 size=$fontsize2>Ist richtig!</font></td></tr>";
		}
elseif ($$q == "") {
echo "<tr><td width=20><font face=Arial color=red size=+0><b>x</b></font></td><td><font face=$fontface2 color=$fontcolor2 size=$fontsize2>Du hast keine Antwort gewählt!</font></td></tr>";
}
else {
echo "<tr><td><font face=Arial color=red size=+0><b>x</b></font></td><td><font face=$fontface2 color=$fontcolor2 size=$fontsize2>Ist falsch!</font></td></tr>";
}
$Frage2++;
}
echo "</table></p></body>";
}
?>
 
da dein formular beim browser gespeichert ist geht das nur mit javascript
nicht mit php

javascript:location.replace('datei2.htm')

damit kann man die history überschreiben sprich die daten vor ort löschen...
 
Zurück