Link to home
Start Free TrialLog in
Avatar of Erikal
Erikal

asked on

After redirect alert from one page, redirected page skipped

3 sunsequent test pages, but all have a conditional redirect statement.
When the redirect is activated from an alert box, new page to be accesses appears for a split second and browser goes on to the following page.
Avatar of hielo
hielo
Flag of Wallis and Futuna image

This would happen in on page1.php you are redirecting to page2.php and then on page2.php you are not meeting the proper conditions to NOT redirect. For example, you may need to show a form, but if you don't pass the proper parameters OR if you pass the wrong parameters from the previous form OR if you do pass the proper parameters but are checking for the wrong values and then you just decide to redirect to the next page.
Avatar of jamespbyrne
jamespbyrne

ok in the code i have below, that you posted on your other question. It appers like you are just redirecting to this page again. This means that the if statment is hitting then redirecting to this page again. Then the whole thing happens again. In the window.location you need to make sure that is the vr test.

Please let me know if that works at all.
//HIELO SAYS: you need to "extract" the data first
 
$row=mysql_fetch_assoc($result); 
 
if ($row['complete']=='1'){
 
<script language="javascript">confirm("You have already completed the Maths Test. Press OK to be directed to the Next Test");
window.location = "http://ccgi.nyorulmaz.plus.com/MathsTest1.php";
</script>
 
	exit;
 
}

Open in new window

>>. It appears like you are just redirecting to this page again.
He said:
"new page to be accesses appears for a split second ..."

the code you posted makes a  call to confirm() so it cannot possibly be that if clause because the confirm will cause the page to "pause" infinitely until the user dismisses it. So it cannot just appear for a split second. The problem is the javascript redirection at the very end of the page which also needs a confirm so that the user "pauses" in between pages.
SOLUTION
Avatar of jamespbyrne
jamespbyrne

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Erikal

ASKER

Again I can't thank you enough.
You are doing a great job.