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;
}

?>

ahh i got to work this out. was a mistake in typing.

<?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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.