note 47031 added to function.header

From: Date: Sun, 31 Oct 2004 17:06:22 +0000
Subject: note 47031 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-79405@lists.php.net to get a copy of this message
I think this is a very important thing to mention about headers (sorry if someone addressed this above, I didn't have time to read each note thoroughly). If you use headers the way I do, you'll be sending users to and from pages along with parameters. One of the most common parameters I use is a simple status message. The problem I've noted is that some browsers don't automatically urlencode() the parameters, and will leave spaces between characters, instead of the %20 value. This causes the web browser to display an INVALID REQUEST message. It has happened to me in Netscape and Safari. Very frustrating. Here's an example of what I sent: <?php header("some_page.php?msg=this is a status message generated by my scripts"); ?> The spaces between words are what cause the problem. I needed to fix it like this: <?php header("some_page.php?msg=" .urlencode("this is a status message generated by my scripts")); ?> Of course there are cleaner methods of doing this, but you get the point. If I had known this at the beginning of my project, I wouldn't have to waste time fixing everything. Hopefully this will save some of you some headaches. =| ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47031 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47031&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47031&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47031&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47031&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47031&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47031&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47031&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79405) next »