-
Middlepage
*Problem*
User will enter number from 1 to 10 at page1.php and page2.php will be displayed basing on the number of input in page1.php.Suppose if visitor enters 8 in page1.php then page2.php will be displayed after 8 seconds.I want there should be any image or middle page (sayin wait) before page2.php.Could you help me in figuring out how to do it?
Thank You.
-
Re: Middlepage
wait.php
PHP Code:
<html>
<head>
<meta http-equiv="Refresh" content="<?=$_REQUEST['wait'];?>; URL=<?=$_REQUEST['redirect'];?>">
</head>
<body>
Please wait, or click <a href="<?=$_REQUEST['redirect'];?>">here</a>
</body>
<html>
so going to wait.php?wait=10&redirect=page2.php
waits for 10 seconds before redirecting to page2.php
Is something like that what you are looking for?
-
Re: Middlepage
Yes that will work but what if i am doing some calculation on backend and want to redirect to page2.php after calculations are completed ?
-
Re: Middlepage
If the values are store in session then yes.
-
Re: Middlepage
Would you please elaborate how ?
-
Re: Middlepage
page1.php
PHP Code:
<?
session_start();
$_SESSION['value'] = "hello World!";
header('location: wait.php?redirect==page2.php&wait=10');
?>
page2.php
PHP Code:
<?
session_start();
print $_SESSION['value'];
?>
-
Re: Middlepage
My bad i missed one thing in above post.
Now in the middle of these both pages an image appearance would be satisfactory and image should be something like "please wait we are doing calculation".This is my last question :)
-
Re: Middlepage
oops no answer to last question :confused:
-
Re: Middlepage
You just need to edit the wait.php page so that there is an image instead of text.
PHP Code:
<html>
<head>
<meta http-equiv="Refresh" content="<?=$_REQUEST['wait'];?>; URL=<?=$_REQUEST['redirect'];?>">
</head>
<body>
<img src="yourimage.jpg" alt="alt text"/>
</body>
<html>
-
Re: Middlepage
and be sure you use striptags() or htmlentities() or something on the input, otherwise you could pass HTML code in the parameters and break the page ;)