I have still a major problem with the formvalues to be remembered...
index.php
I have 3 forms:
1 - "kateg" this is where the visitor makes a geographical selection (north South etc)
2 - "kon" Male or Femal
3 - "allform" is the form where the visitor rate the shown info (Good or Bad) This data is posted to the database and then RELOADS the page with another users info shown on the page. The problem is that I (thanks to Leaterback) have made the KATEG and KON formvalues to still be there when the page reloads.
This is the problem, When kateg or kon value are set only one of them then it work to rate the info and the page reloads, But if they both are given a value and then clicking one of the rate buttons then it just keep on opening the page finally gicving 404-error
<?
if(!isset($_POST))
{
reset ($HTTP_POST_VARS);
while (list ($kateg, $kon) = each ($HTTP_POST_VARS))
{}
}
else
{
extract($_POST);
}
if (isset($kateg) and ($kateg != ""))
{
$katecho = "<input type=\"hidden\" name =\"kateg\" value=\"$kateg\">";
}
if (isset($kon) and ($kon != ""))
{
$konecho = "<input type=\"hidden\" name =\"kon\" value=\"$kon\">";
}
?>
<form action="index.php" name="kateg" method="post">
<input type="radio" value="N"<?php echo ($kateg == "N" ? "checked" : ""); ?>
name=kateg onclick="this.form.submit()">North<br>
<input type="radio" value="S"<?php echo ($kateg == "S" ? "checked" : ""); ?>
name=kateg onclick="this.form.submit()">South<br>
<input type="radio" value="E"<?php echo ($kateg == "E" ? "checked" : ""); ?>
name=kateg onclick="this.form.submit()">East
<? echo $konecho; ?>
</form>
<form action="index.php" method="post" onclick="this.form.submit()">
<input type="radio" value="F" <?php echo ($kon == "F" ? "CHECKED" : ""); ?> name="kon" onclick="this.form.submit()">Female
<input type="radio" value="M" <?php echo ($kon == "M" ? "CHECKED" : ""); ?> name="kon" onclick="this.form.submit()" >MALE
<? echo $katecho; ?>
</form>
<form action="index.php" " name="allform" method="post" onchange="this.form.submit()">
<p><img src="<? print($url); ?>" width=350 border=3 vspace=4> </p>
<p><input type=hidden name=op value=rate>
<input type=hidden name=id value="<? print($id); ?>">
</p><tr>
<td colspan=3 align=center><table width=350 bgcolor="#CC3333" >
<tr>
<td valign=bottom><input type=radio name=r value=1 onclick="this.form.submit()">
<font size=1 >good</font></td>
<td valign=bottom><input type=radio name=r value=2 onclick="this.form.submit()">
<font size=1 >bad</font></td><input type=hidden name=rate value=1>
<? echo $katecho; ?>
<? echo $konecho; ?>
</form>
This problem is due to the 2 last <? echo $katecho; ?>
<? echo $konecho; ?>
If I delete those then it work but when the page reloads then the values are reseted, and if they are left there then it just gives 404 error ewhen both values are set.
How can I overcome this??