Forum Moderators: coopster
<?php
$currval=$error=null;
// Make post CAPS, it won't work on some servers/versions otherwise
// Didn't on the server I tested it on, anyway . . .
if (isset($_POST['field_one'])) {
if ($_POST['field_one'] == "Corn flakes") {
header("location:https://www.google.com");
exit; // not really necessary, just retentive that way . . .
}
else {
$currval=$_POST['field_one']; // NOT CLEANSED, for example only!
$error=""$currval" is the wrong word.";
}
}
?>
<html>
<head>
<title>Page one</title>
</head>
<body>
<?php if ($error) { echo "<p>$error</p>"; } ?>
<form action="formtest.php" method="post">
<input type="text" name="field_one" id="field_one" value="<?php echo $currval ?>">
<input type="submit" name="button" value="Enter">
</form>
</body>
</html>