Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> [php] Header Function
Blessed
post Apr 9 2007, 10:03 AM
Post #1


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



[PHP] Header function

Greetings

we are going to use the header() funtion to redirect

start making a file called page.php

at the top of the file add
CODE
<?php

?>


Example 1
After <?php add

CODE
header('Location: http://www.trap17.com');


the LOCATION means
where you want it to go.

Example 2
you also can define a file that you want to redirect to
After <?php add

CODE
header('Location: index.php');


Example 3
you also can add a timer to it laugh.gif
After <?php add

CODE
header('Refresh: 0; url=http://www.trap17.com' );


Refresh: 0; means that it will refresh to the url you entered and
the 0; means the seconds it wait to refresh.

Example 4
now if you want to go to the root of the site use this laugh.gif
After <?php add

CODE
header('Refresh: 3; url=/');



Have fun with this tutorial.. laugh.gif

This post has been edited by Blessed: Apr 9 2007, 10:04 AM
Go to the top of the page
 
+Quote Post
shadowx
post Apr 9 2007, 01:09 PM
Post #2


A clever man learns from his own mistakes, a WISE man learns from those of OTHERS
***********

Group: [HOSTED]
Posts: 1,028
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719



Hey, nice bit of info there, i never knew you could add a timer to the redirect thingy, that could be very useful.

Its worth mentioning that any HEADER function wont work if there is output before it. Eg if you used ECHO or PRINT before using the HEADER it will give an error, i think you can d ther things like form processing, database connections etc but nothing can be output to the browser before the HEADER, that caused me some headaches in the past.
Go to the top of the page
 
+Quote Post
Blessed
post Apr 9 2007, 02:10 PM
Post #3


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



thanx shadowx for givven that last info for me

thanx for the support laugh.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Getting List Of Directories And Files Using Php(6)
  2. Spacer Below Header :s(3)
  3. Error When Using file_put_contents()(4)
  4. Sending Attachments Using Email Function In Php(2)
  5. Need Help With The Header() Function(2)
  6. Question For The If And Echo Function(2)
  7. Need Help With Php(2)
  8. php header() function help needed(4)
  9. How To Use A Link To Call Function In Php?(8)
  10. Include File.php?id=something(13)
  11. Php Header Problem(11)
  12. How To Enable Mail() Function In Php(1)
  13. Question About The Mail() Function(2)
  14. Regexp Function Preg_match_all()(0)
  15. Email Header Inject Test(0)
  1. Explode Function Help(1)
  2. Header Redirect Errors(5)
  3. How Good Is This Data Cleaning Function?(2)
  4. The Extract() Function(6)
  5. Error With Joomla Template(1)
  6. [php](simple) Using Functions To Combine Values In A Form(2)
  7. Mail() Clone(5)
  8. The Best Zip Function(1)
  9. Php Explode Function Help(4)
  10. How To Check If Fsockopen Function Is Enabled?(2)
  11. Arrays Outside A Function(3)
  12. Endif function?(6)
  13. PHP Function To Add Previous and Next Page Feature(5)


 



- Lo-Fi Version Time is now: 12th October 2008 - 03:37 PM