473,498 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do i creat a php url after 3 seconds?

117 New Member
I need to create a a simple load index.php after 3 seconds with php.

On my login page i want it to say Welcome back, $userid
Loding page... and have it load the index.php after 3 seconds is this possible?
Sep 9 '07 #1
7 2643
Atli
5,058 Recognized Expert Expert
Hi.

You mean something like this:
Expand|Select|Wrap|Line Numbers
  1. header('Refresh: 3; url=index.php');
  2. print 'Welcome back, $userid. You will be redirected in 3 seconds!';
  3.  
Sep 9 '07 #2
Breana
117 New Member
Expand|Select|Wrap|Line Numbers
  1. <? header('Refresh: 3; url=index.php'); ?>
Dont seem to work, i cant use it in my header.php or it will load all pages after 3 seconds...

Or did i do the above code wrong?
Sep 9 '07 #3
Atli
5,058 Recognized Expert Expert
This, as with all headers, must be done before anything is printed (or echoed) (or otherwise sent) to the output.

If that doesn't work for you you could always cheat and use JavaScript...
Expand|Select|Wrap|Line Numbers
  1. echo "Redirecting in 3 seconds...";
  2. echo '
  3. <script type="text/javascript">
  4.   setTimeout(function(){location.href="index.php";}, 3000);
  5. </script>';
  6.  
Sep 9 '07 #4
Breana
117 New Member
Ok, i dident know it had to be at the very top lol.
It works thanx :)

SOLVED!
Sep 9 '07 #5
JeremyMiller
69 New Member
Hi.

You mean something like this:
Expand|Select|Wrap|Line Numbers
  1. header('Refresh: 3; url=index.php');
  2. print 'Welcome back, $userid. You will be redirected in 3 seconds!';
  3.  

I think you meant

Expand|Select|Wrap|Line Numbers
  1. header('Refresh: 3; url=index.php');
  2. print "Welcome back, $userid. You will be redirected in 3 seconds!";
  3.  
That will replace $userid with the value instead of showing $userid itself.
Sep 9 '07 #6
kovik
1,044 Recognized Expert Top Contributor
Also, just an FYI, the "Refresh" header is not supported by all browsers. I believe <meta> redirection is a more reliable choice.
Sep 9 '07 #7
Atli
5,058 Recognized Expert Expert
Also, just an FYI, the "Refresh" header is not supported by all browsers. I believe <meta> redirection is a more reliable choice.
True. But I've tested the "Refresh" header in all my usual browsers (IE, FF, Opera, Safari) and they all support it.

Honestly, if your browser doesn't support basic things like this, you should seriously consider switching browsers!
(Tho I strongly suspect that you, like me, have at least a couple of browser set up :)

I think you meant

Expand|Select|Wrap|Line Numbers
  1. header('Refresh: 3; url=index.php');
  2. print "Welcome back, $userid. You will be redirected in 3 seconds!";
  3.  
That will replace $userid with the value instead of showing $userid itself.
She said she wanted to print $userid :P
But your right. My example would indeed not print the value of $userid.
Sep 9 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1409
by: bohemia | last post by:
Hi all, I using visual c++ to creat a dll to wrapper a class that provided by another library.So I add the .lib to my win32 dll project under the link .and in my project I add some header files...
1
4013
by: Timo | last post by:
Hi there, This is my first time here,.....I am a Perl developer by trade but currently working on Access database. Anyway,...I use this artical from Microsoft knowldge base number (285820) to...
18
2205
by: blossoming_hearts | last post by:
now i have problem i.e how 2 creat a web browser ? can any1 help me on this which languge i need 2 know what other things i need 2 know to make a web browser ? plz. help
3
1390
by: ironpythonster | last post by:
Hi everyone,there is a simply question puzzle me: Under the CPP,where can use the char* to creat a string class for use,but under the .NET Framework? How to use C# to creat a string class as the...
0
1140
by: dhanuka | last post by:
please i need u are help ! i would like to creat programe can not be affect in end task as we creat program in vb in that program can be remove through end task program so i need the program to...
0
992
by: dhanuka | last post by:
plese!dhanuka@gmail.com i need your help i hop to creat artificial intaligon program dut i have not good in vb i want to creat programe but it is hase to be easy and can be undestand well need...
1
2763
by: dhanuka | last post by:
hai i hop to creat a program in vb, it must be a registration form through the program we have to add some details for this program Ex - we have to add some persons details i can creat that...
3
9513
akashazad
by: akashazad | last post by:
Hi guys in my application (VB6.0). I want to creat a folder in to which i want to creat a text file . so is there any one who can give me code for that . ...
0
1437
by: Jason7899 | last post by:
hi, i use the crystal report for creat reports and print all that i want in vb or vb.net now i looking for a such like crystal report for use in php or html all data is retrieve from a mysql...
0
6998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.