Is it Ok(valid) to use a query string in a location header e.g
header('location:login.php?id=$theid').
A novice question,eh?
| SitePoint Sponsor |

Is it Ok(valid) to use a query string in a location header e.g
header('location:login.php?id=$theid').
A novice question,eh?



Yes
Computers and Fire ...
In the hands of the inexperienced or uneducated,
the results can be disastrous.
While the professional can tame, master even conquer.







If a UA (i.e. a browser) comes along that strictly follows standards then yes, it will break. However, as every browser currently out there makes allowances for violations like this, in actuality it is merely bad practice.
Personally, I prefer to take the extra 2 seconds to make my location headers absolute URLs just in case a standards-strict browser does ever come along.
I think they may be some issues with ssl-encrypted pages, if you don't follow the standard. I'm not sure, I just think I remember having a problem in that direction once.
Bookmarks