Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEWBIE URL Redirection

Status
Not open for further replies.

storm197

MIS
Oct 9, 2002
55
CA
Hi,

I'm quite newbie at PHP.

In a IF statement, I want to open an URL if a condition occur. I read in a book that the three way to open an URL is Header() (which is not good for me now), <A> tags, and Form buttons.

If there any function that can automaticly open a page in PHP ?
 
I'm not sure I understand.

If you want to redirect a user's browser to another page, you can send a "Location" header using PHP's header() function. There is example code on the online manual page.

If you want PHP to fetch another page and stream that page to your users, you have a number of options, depending on your configuration, version of PHP, and available libraries.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Here is a sample of what i'm trying to do...

If ($samplevariable == 1)
{
[open test1.php];
}

Elseif ($samplevariable == 2)
{
[open test2.php];
}

The line between the [] is not a function i'm trying to call, it's the action I would like PHP to do .

I think Header() is not a good option because it must be sent at the beginning of the page isn'it ?
 
header() does not necessarily have to be invoked at the beginning of a script. It must be invoked before your script produces any output.
 
Ok, it was really a newbie question. Header() is exactly what I needed.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top