RE: [PHP] Echo # problem
| From: | Ford, Mike [LSS] | Date: | Wed, 12 Feb 2003 13:19:42 +0000 |
| Subject: | RE: [PHP] Echo # problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135304@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Chris Hayes [mailto:chayes@antenna.nl]
> Sent: 12 February 2003 13:02
>
> At 13:46 12-2-03, you wrote:
> >The code I am trying to get working is shown below however,
> as the # is
> >interpreted as a comment the header function is only redirecting to
> >
> >./itemadmin.php3?submittedby=$submittedby&cat=$cat
> >
> >$head = "./itemadmin.php3?submittedby=$submittedby&cat=$cat#$edit";
> >header ("Location:$head");
>
> I think the problem may be that the #zzz should be before
> the ?x=1&y=2
No that's wrong -- the #anchor part must always be the last thing in the URL.
A couple of things occur:
- make sure $edit has something valid in it (by temporarily echo-ing it just before the header
call, if necessary);
- rewrite your Location: header to be technically valid: (a) there should be a space between
Location: and the URL, and (b) it really should contain an absolute URL, not a relative one, so:
header("Location: http://www.example.com/path/to/itemadmin.php3?etc,etc").
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211