note 50341 added to function.header
| From: | php at richardneill dot org | Date: | Fri, 25 Feb 2005 02:53:30 +0000 |
| Subject: | note 50341 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85521@lists.php.net to get a copy of this message | ||
Warning about Query strings in header: Location.
Normally, when using ampersands in a query string, '&' is wrong, and
'&' is right. [see http://www.htmlhelp.com/tools/validator/problems.html#amp
]
Eg: This is the correct way to write a link: <a href="http://example.com/index.php?foo=bar&baz=wombat">link</a>
BUT, when writing a redirect, the exact reverse seems to be true. The following is wrong (It
doesn't work in either Mozilla or Konqueror - in both cases, the value of baz is not set):
$redirect_location = 'http://example.com/index.php?foo=bar&baz=wombat';
header("Location: $redirect_location");
In this case, it seems as though '&' is necessary.
I'm fairly sure of this, through experiment, but I don't know why it should be true. It
seems a bit perverse!
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50341
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50341&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50341&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50341&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50341&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50341&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50341&report=yes
Search -- http://master.php.net/manage/user-notes.php