0

hi can anyone tell me why doesnt my page redirect if variable $Valid is = 0
thanks

also if you could correct me would be appreciated

<?php
$name = $_POST['Name'];
$age = $_POST['Age'];
$amount = $_POST['Cover'];
$plan = $_POST['Plan'];
$benefit = $_POST['Benefit'];
$Year = DetYear($plan);
$Valid = ChkAge($age, $Year);
$redirect = "QuoteAgeError.html";

if ($Valid == 0){
    header($redirect);
}
function DetYear($p) {
   if ($p == 1){
       return 10;
   }
   else if ($p == 2){
       return 15;
   }
   else if ($p == 3){
       return 20;
   }
   else if ($p == 4){
       return 25;
   }
   else if ($p == 5){
       return $_POST['Year'];
   }
}

function ChkAge($a,$y) {
    $t = $a + $y;
    if ($t > 60){
        return 0;
    }
    else return 1;
}

?>
2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by nonshatter
0
<?php

if ($Valid == 0)
{
	echo 'Incomplete Data, Redirecting...';
			Redirect("QuoteAgeError.html");
}

/**
 * JavaScript Redirect Function - Redirects the user should the result data be empty
 * @param string $url the dynamic url to redirect to
 */
function Redirect($url) 
{ ?>
	<script type="text/javascript">
		window.location = "<?php echo $url ?>"
	</script>
<?php 
}
?>

This will work

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.