The hidden field function always reports field as empty which is what I want, but it actually launches the form in a new window.
<?php
if (isset($_POST['submit'])) {
/************************ SERVER SIDE VALIDATION **************************************/
/********** This validation is useful if javascript is disabled in the browswer ***/
foreach($_POST as $key => $row)
{
$row = trim($row);
if($row == "")
{
$err .= urlencode("I\'m sorry, but ". $key. " is empty. \n");
header("Location: /Topten/bin/lib/Pollform.php?msg=$err");
exit();
}
}
if(!String.IsNullOrEmpty(Pollform.Form("thishiddenfield")))
{
form.reset();
$err = urlencode("ERROR: Unable to process!");
header("Location: /Topten/bin/lib/Pollform.php?msg=$err");
exit();
}
include 'db.php';
$sql_insert = "INSERT into `results`
(`fc`,`sec`,`tc`,`foc`,`fic`,`sic`,`sevc`,`ec`,'nc','tec'
)
VALUES
('$data[fc]','$data[sec]','$data[tc]','$data[foc]','$data[fic]','$data[sic]','$data[sevc]','$data[ec]','$data[nc]','$data[tec]',$data('count')
)
";
mysql_query($sql_insert,$con) or die("Insertion Failed:" . mysql_error());
$sql_insert = "INSERT into `users`
(`date`,`user'
)
VALUES
(now(),'$pUser'
)
";
mysql_query($sql_insert,$con) or die("Insertion Failed:" . mysql_error());
form.reset();
}
echo "
<form action=\"/Topten/bin/lib/Pollform.php\" method=\"post\" name=\"pollForm\" id=\"currentsurvey\">
<table width=\"100%\" border=\"1\" cellspacing=\"5\" cellpadding=\"3\">
<tr>
<td width=\"30%\"><input type=\"text\" value=\""; if(isset($_POST["fc"])) echo "".$_POST["fc"].""; echo "\" name=\"fc\" ></td>
<td width=\"70%\" rowspan=\"12\" align=\"left\" valign=\"top\">Welcome to this month's Survey. This month you get to decide: THE GREATEST MOVIE EVER!!!!
</td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["sec"])) echo "".$_POST["sec"].""; echo "\" name=\"sec\" ></td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["tc"])) echo "".$_POST["tc"].""; echo "\" name=\"tc\" ></td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["foc"])) echo "".$_POST["foc"].""; echo "\" name=\"foc\" ></td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["fic"])) echo "".$_POST["fic"].""; echo "\" name=\"fic\" ></td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["sic"])) echo "".$_POST["sic"].""; echo "\" name=\"sic\" ></td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["sevc"])) echo "".$_POST["sevc"].""; echo "\" name=\"sevc\" ></td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["ec"])) echo "".$_POST["ec"].""; echo "\" name=\"ec\" ></td>
</tr>
<tr>
<td><input type=\"text\" value=\""; if(isset($_POST["nc"])) echo "".$_POST["nc"].""; echo "\" name=\"nc\" ></td>
</tr>
<td><input type=\"text\" value=\""; if(isset($_POST["tec"])) echo "".$_POST["tec"].""; echo "\" name=\"tec\" ></td>
</tr>
<td colspan=\"2\">
<input type=\"hidden\" name=\"thishiddenField\" id=\"thishiddenField\" value=\"\" />
<br/><input name=\"submit\" type=\"submit\" value=\"Submit\"> </td>
</tr>
</table>
</form>";
?>