note 51542 added to function.header

From: Date: Sun, 03 Apr 2005 10:25:47 +0000
Subject: note 51542 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-87391@lists.php.net to get a copy of this message
"benjamin at sonntag dot fr 11-Mar-2005 07:03 About michael and it's header "Refresh", be careful, The HTTP standard requires the following syntax : <?php // Redirects the browser quickly (don't forget the URL=) header("Refresh: 0; URL=http://www.php.net"); ?> this is in fact the only way to prevent the multi-post issue with all browsers (ie, firefox ...)" I disagree. This is the correct way: <?PHP function postredir($url) { header('HTTP/1.1 303 See Other'); header("Location: ".$url); echo "We are now redirecting you to <a href='".urlencode($url)."'>$url</a>..."; } ?> 303 See Other means convert any request into a GET request - i.e. even if it submitted a POST request to this url, use GET on the redirected URL. ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51542 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51542&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51542&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51542&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51542&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51542&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51542&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87391) next »