Solved

After redirect alert from one page, redirected page skipped

Posted on 2008-10-06
6
515 Views
Last Modified: 2013-12-12
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.
0
Comment
Question by:Erikal
  • 3
  • 2
6 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 22650682
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.
0
 
LVL 1

Expert Comment

by:jamespbyrne
ID: 22651002
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

0
 
LVL 82

Expert Comment

by:hielo
ID: 22651155
>>. 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.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Assisted Solution

by:jamespbyrne
jamespbyrne earned 200 total points
ID: 22651295
Ya i did not even se that, you will need to add a confirm box there also. But that code should only hit after the form has been submitted, so it should only do that after the form has been shown, and then the submit button is hit.

My guess is that the if (!isset($_POST['submit']))

is being set somewhere else already. like for examle a login page.

in your form try to remane your submit button to something else such as maths_submit

example is below.

then change your php code to check if maths_submit is set.

Let me know if that works for you.
<input type='submit' name='maths_submit' value='Submit this test'>

Open in new window

0
 
LVL 82

Accepted Solution

by:
hielo earned 300 total points
ID: 22651447
>>My guess is that the if (!isset($_POST['submit'])) is being set somewhere else already.
The problem stems from the login form having the same name="submit". I already explained this on the first problem.
0
 

Author Closing Comment

by:Erikal
ID: 31503319
Again I can't thank you enough.
You are doing a great job.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now