Try replacing the line: header("Location:articlelist.php?lid=$league_id&yr=$season&gid=$gid&pid=$pid&pn=$pn");
With this: echo "<script type=\"text/javascript\">window.location.href=\'articlelist.php?lid=".$league_id."&yr=".$season."&gid=".$gid."&pid=".$pid."&pn=".$pn."\'</script>";
and similarly in the else part as well.Change the variable names to the correct ones in my code as well ofcourse.