If I try to submit a piece of text from a form that starts with # - or using GET, I don't get any data. Any idea what is going on here?
URL: {blah}/test.php?test1=foo&test2=#bar
Entire PHP Code:
echo $_REQUEST['test1'];
echo '<br/>';
echo $_REQUEST['test2'];
echo '<br/>';
var_dump($_GET);
Gives this in the browser:
foo
array(2) { ["test1"]=> string(3) "foo" ["test2"]=> string(0) "" }
If I write some more text before the # e.g. "foo #bar" then I get "foo"
The #
character in a URL has special meaning. It indicates the start of the fragment identifier.
You need to percent encode it (as %23
) if you want to include it as data.