Hi,
Seem to have a unique problem. I'm doing form validation using a php script. I initially wrote this code in 2007. All of a sudden it stopped working, and I've been trying to figure out why.
Here's the code:
<?php
$error_msg = '';
// Only Validate Form when it is submitted
if (isset($formSubmit)) {
if (!isset($_SESSION["First_Name"])) {
$get_mbr_id = urlencode ($_POST["GetMbrID"]);
$_SESSION["MemberID"] = $get_mbr_id;
}
if (!headers_sent()) {
header ("Location: mywebsite.com");
exit (0);
}
}
if (isset($formExit)) {
if (!headers_sent()) {
header ('Location: mywebsiteexit.com');
exit (0);
}
}
?>
<html>
<head>
</head>
<body>
<form name="select_action" method="POST" action="select_action">
<br>
<center>
<input type="submit" name="formSubmit" value="Next">
<input type="reset" name="fieldReset" value="Reset">
<input type="submit" name="formExit" value="Cancel">
</center>
</form>
</body>
</html>
The problem I'm having is this: If the html form code is present, then the header redirect doesn't work. However, if I remove the html form code, change the if(isset(formSubmit))
statement to if(!isset(formSubmit))
, then the header redirect will work.
I can't figure what is happening with the form code that causes the header() redirect not to happen.
Any help would be appreciated!