php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11564 Passing variables using the GET method
Submitted: 2001-06-19 12:18 UTC Modified: 2001-06-19 18:39 UTC
From: chaz at ro0t dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Win32
Private report: No CVE-ID: None
 [2001-06-19 12:18 UTC] chaz at ro0t dot com
<?
if($name) {
 echo $name;
 }else{
 echo "<a href=\"$PHP_SELF?name=#asdf\">Click me</a>";
 }
?>

When you click on 'Click Me', it displays the link again, when it should output '#asdf'. This does not happen using the POST method.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-19 18:39 UTC] cnewbill@php.net
This is a browser issue, since it uses # as the key that it needs to go that particular anchor of a page.

Use urlencode when passing variables in the URL like that.

<?
if($name) {
 echo $name;
 }else{
 echo "<a href=\"$PHP_SELF?name=".urlencode("#asdf")."\">Click me</a>";
 }
?>

-Chris
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 08:01:30 2024 UTC