View Single Post
  #10 (permalink)  
Old 03-11-2009, 11:57 AM
grace55 grace55 is offline
Administrator
Site Admin
 
Join Date: Jun 2008
Posts: 342
Default A journey leads to php....

Redirects using PHP HEADER

You can use PHP to create redirects to other pages or websites. This is quite useful if you do any kind of affiliate marketing and hate the ugly links provided - use the Header command to clean ‘em up!

<?php
header (“Location: http://linktoredirect.com”);
?>


When a viewer visits this PHP page in their browser, they will be redirected to the link reflected in the “Location” part of the code. This is a good method to use, since other redirect methods using HTML and Javascript can easily be blocked. Header can be used for other functions, but this is one of the more common uses, so we’ll leave it at that for now.


Section One Overview...

While we have not covered the entirety of basic PHP commands, the ones we have covered are among the most common and can be used in almost any web project.

  • ECHO: Outputs to the screen.
  • STRING: Content within a PHP command.
  • VARIABLES: Something equals something else.
  • DATE: A way to display date/time.
  • INCLUDE: Pull in the contents of another file.
  • REQUIRE: Require the contents of another file.
  • HEADER: Redirects to new file / URL.


QUICK QUIZ!!!

1. What is the difference between INCLUDE and REQUIRE?
2. Can we ECHO words with quotation marks? How?
3. What is a VARIABLE used for?

I hope all your answers were correct.

Very good. Now, take a short brain break...then go on to the next section!
__________________
Christian Prayer Forum
Reply With Quote