Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2004, 06:07 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default Header functions is same to asp respose.redirect()

any one would like to tell me another method except header to redirect borwser to specifiede url or page just kile asp's response.redirect(url)

thanks

 
Old March 8th, 2004, 12:00 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I have absolutely no idea why you would want this, but here is one way:

echo "<meta http-equiv=refresh content=\"0; url=wherever.php\">";

another:

echo "<script language=javascript>window.location=\"wherever.php \";</script>";

HTH,

----------
---Snib---
----------
 
Old March 9th, 2004, 12:19 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

dear snib i want to know that is any other way except header() in php that we able to redirect browser to different pages at specified condition and for reference i quote the ASP's response.redirect()method actuly i want to redirect the users to login page if they r not logged in and if they r logged in the index page should be run



 
Old March 12th, 2004, 04:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Her ya go:

<?php

function redirect($url)
{
   header("Location: $url");
}

?>

ASP's response.redirect() function probably just assembles the Location HTTP header anyway. PHP doesn't have a function specifically for this header; they just allow the programmer to send whatever header text they require.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
redirect:write printing xml header in output csv jon.london XSLT 4 October 1st, 2007 05:47 AM
header redirect not working guillermo Beginning PHP 2 June 23rd, 2006 05:33 AM
Hyperlink, Javascript, Respose which is best? ddudley3 ASP.NET 2.0 Professional 1 February 7th, 2006 12:36 AM
Q. How do I redirect users? (Location Header) richard.york PHP FAQs 0 April 3rd, 2004 07:40 PM
header redirect dazednconfused Beginning PHP 5 September 9th, 2003 01:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.