redirecting in php

Thread Solved

Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster

redirecting in php

 
0
  #1
22 Days Ago
i'm a newbie in php, and i know this question maybe silly
i tried to create a php file that will redirect to yahoo.com.
i have searched in google, and i found that the code should be
  1. <?php
  2. header('Location:http://www.yahoo.com
  3. ?>
  4.  

but i found that it didn't work.
anyone has clue about this?
does the version of php affect it?
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #2
22 Days Ago
sorry, i meant
header('Location:http://www.yahoo.com');
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro
 
0
  #3
22 Days Ago
Does it do anything?

Do you get a blank screen, an error?
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 942
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 125
ardav's Avatar
ardav ardav is offline Offline
Posting Shark
 
0
  #4
22 Days Ago
This may sound stupid, but:
Do you have php installed?
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #5
22 Days Ago
Originally Posted by Will Gresham View Post
Does it do anything?

Do you get a blank screen, an error?
yes, i only get blank page and the active page is still the php file that contains that code. do you have any clue about this? thanks for your response.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #6
22 Days Ago
Originally Posted by ardav View Post
This may sound stupid, but:
Do you have php installed?
yes, i have installed wamp server, included apache, php, and mysql in it. the version of the php is 5.2.5, so i don't think that it's because the version of the php. thanks for your response.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 4
Reputation: shlomia is an unknown quantity at this point 
Solved Threads: 1
shlomia shlomia is offline Offline
Newbie Poster
 
0
  #7
21 Days Ago
Originally Posted by AirGear View Post
yes, i have installed wamp server, included apache, php, and mysql in it. the version of the php is 5.2.5, so i don't think that it's because the version of the php. thanks for your response.
What browser are you using (type & version)?

Can you please right click on the page, choose "view source" and paste the contents here?
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #8
21 Days Ago
here is the code
  1. <?
  2. header("location:index.html");
  3. ?>

and the address is still at "file:///C:/Program%20Files/wamp/www/Projek%20SBD/Projek/logout.php" (NB : logout.php is the name of the file that contains that code)

i'm using mozilla firefox, version 3.0.15.
thanks for your response.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 4
Reputation: shlomia is an unknown quantity at this point 
Solved Threads: 1
shlomia shlomia is offline Offline
Newbie Poster
 
0
  #9
21 Days Ago
Originally Posted by AirGear View Post
here is the code
  1. <?
  2. header("location:index.html");
  3. ?>

and the address is still at "file:///C:/Program%20Files/wamp/www/Projek%20SBD/Projek/logout.php" (NB : logout.php is the name of the file that contains that code)

i'm using mozilla firefox, version 3.0.15.
thanks for your response.
It seems like you're trying to directly open the file in the browser instead of using the apache web server installed on your computer for accessing the file.
your URL should be something like:
  1. http://localhost/Projek%20SBD/Projek/logout.php

If you open the file itself, the PHP code doesn't run. The browser simply displays the content of the file...
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #10
21 Days Ago
i think you're right, but it's still the same when i change the address into
"http://127.0.0.1/projek SBD/projek/logout.php" or
"http://localhost/projek SBD/projek/logout.php"

i'm a little bit frustated now ugh..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC